forked from qt-creator/qt-creator
introduce ProKey class
while this is actually just an alias for ProString (with explicit zero-cost conversions only), it nicely illustrates the use of particular variables. it also serves to hide the NoHash hack from public view. Change-Id: Iaf9283c64f320ad84a77d9573d1fde6d401c49df Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
@@ -57,7 +57,7 @@ ProFileEvaluator::~ProFileEvaluator()
|
||||
|
||||
bool ProFileEvaluator::contains(const QString &variableName) const
|
||||
{
|
||||
return d->m_valuemapStack.top().contains(ProString(variableName));
|
||||
return d->m_valuemapStack.top().contains(ProKey(variableName));
|
||||
}
|
||||
|
||||
QString ProFileEvaluator::value(const QString &variable) const
|
||||
@@ -71,7 +71,7 @@ QString ProFileEvaluator::value(const QString &variable) const
|
||||
|
||||
QStringList ProFileEvaluator::values(const QString &variableName) const
|
||||
{
|
||||
const ProStringList &values = d->values(ProString(variableName));
|
||||
const ProStringList &values = d->values(ProKey(variableName));
|
||||
QStringList ret;
|
||||
ret.reserve(values.size());
|
||||
foreach (const ProString &str, values)
|
||||
@@ -82,7 +82,7 @@ QStringList ProFileEvaluator::values(const QString &variableName) const
|
||||
QStringList ProFileEvaluator::values(const QString &variableName, const ProFile *pro) const
|
||||
{
|
||||
// It makes no sense to put any kind of magic into expanding these
|
||||
const ProStringList &values = d->m_valuemapStack.at(0).value(ProString(variableName));
|
||||
const ProStringList &values = d->m_valuemapStack.at(0).value(ProKey(variableName));
|
||||
QStringList ret;
|
||||
ret.reserve(values.size());
|
||||
foreach (const ProString &str, values)
|
||||
@@ -167,7 +167,7 @@ QStringList ProFileEvaluator::absoluteFileValues(
|
||||
|
||||
ProFileEvaluator::TemplateType ProFileEvaluator::templateType() const
|
||||
{
|
||||
const ProStringList &templ = d->values(ProString("TEMPLATE"));
|
||||
const ProStringList &templ = d->values(ProKey("TEMPLATE"));
|
||||
if (templ.count() >= 1) {
|
||||
const QString &t = templ.at(0).toQString();
|
||||
if (!t.compare(QLatin1String("app"), Qt::CaseInsensitive))
|
||||
@@ -191,7 +191,7 @@ bool ProFileEvaluator::accept(ProFile *pro, QMakeEvaluator::LoadFlags flags)
|
||||
|
||||
QString ProFileEvaluator::propertyValue(const QString &name) const
|
||||
{
|
||||
return d->m_option->propertyValue(ProString(name)).toQString();
|
||||
return d->m_option->propertyValue(ProKey(name)).toQString();
|
||||
}
|
||||
|
||||
#ifdef PROEVALUATOR_CUMULATIVE
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace ProStringConstants;
|
||||
|
||||
// from qhash.cpp
|
||||
uint ProString::hash(const QChar *p, int n)
|
||||
{
|
||||
@@ -66,29 +64,29 @@ ProString::ProString(const ProString &other, OmitPreHashing) :
|
||||
{
|
||||
}
|
||||
|
||||
ProString::ProString(const QString &str) :
|
||||
ProString::ProString(const QString &str, DoPreHashing) :
|
||||
m_string(str), m_offset(0), m_length(str.length()), m_file(0)
|
||||
{
|
||||
updatedHash();
|
||||
}
|
||||
|
||||
ProString::ProString(const QString &str, OmitPreHashing) :
|
||||
ProString::ProString(const QString &str) :
|
||||
m_string(str), m_offset(0), m_length(str.length()), m_file(0), m_hash(0x80000000)
|
||||
{
|
||||
}
|
||||
|
||||
ProString::ProString(const char *str) :
|
||||
ProString::ProString(const char *str, DoPreHashing) :
|
||||
m_string(QString::fromLatin1(str)), m_offset(0), m_length(qstrlen(str)), m_file(0)
|
||||
{
|
||||
updatedHash();
|
||||
}
|
||||
|
||||
ProString::ProString(const char *str, OmitPreHashing) :
|
||||
ProString::ProString(const char *str) :
|
||||
m_string(QString::fromLatin1(str)), m_offset(0), m_length(qstrlen(str)), m_file(0), m_hash(0x80000000)
|
||||
{
|
||||
}
|
||||
|
||||
ProString::ProString(const QString &str, int offset, int length) :
|
||||
ProString::ProString(const QString &str, int offset, int length, DoPreHashing) :
|
||||
m_string(str), m_offset(offset), m_length(length), m_file(0)
|
||||
{
|
||||
updatedHash();
|
||||
@@ -99,18 +97,12 @@ ProString::ProString(const QString &str, int offset, int length, uint hash) :
|
||||
{
|
||||
}
|
||||
|
||||
ProString::ProString(const QString &str, int offset, int length, ProStringConstants::OmitPreHashing) :
|
||||
ProString::ProString(const QString &str, int offset, int length) :
|
||||
m_string(str), m_offset(offset), m_length(length), m_file(0), m_hash(0x80000000)
|
||||
{
|
||||
}
|
||||
|
||||
void ProString::setValue(const QString &str)
|
||||
{
|
||||
m_string = str, m_offset = 0, m_length = str.length();
|
||||
updatedHash();
|
||||
}
|
||||
|
||||
void ProString::setValue(const QString &str, OmitPreHashing)
|
||||
{
|
||||
m_string = str, m_offset = 0, m_length = str.length(), m_hash = 0x80000000;
|
||||
}
|
||||
@@ -127,6 +119,32 @@ uint qHash(const ProString &str)
|
||||
return str.updatedHash();
|
||||
}
|
||||
|
||||
ProKey::ProKey(const QString &str) :
|
||||
ProString(str, DoHash)
|
||||
{
|
||||
}
|
||||
|
||||
ProKey::ProKey(const char *str) :
|
||||
ProString(str, DoHash)
|
||||
{
|
||||
}
|
||||
|
||||
ProKey::ProKey(const QString &str, int off, int len) :
|
||||
ProString(str, off, len, DoHash)
|
||||
{
|
||||
}
|
||||
|
||||
ProKey::ProKey(const QString &str, int off, int len, uint hash) :
|
||||
ProString(str, off, len, hash)
|
||||
{
|
||||
}
|
||||
|
||||
void ProKey::setValue(const QString &str)
|
||||
{
|
||||
m_string = str, m_offset = 0, m_length = str.length();
|
||||
updatedHash();
|
||||
}
|
||||
|
||||
QString ProString::toQString() const
|
||||
{
|
||||
return m_string.mid(m_offset, m_length);
|
||||
@@ -188,7 +206,7 @@ QChar *ProString::prepareAppend(int extraLen)
|
||||
QChar *ptr = (QChar *)neu.constData();
|
||||
memcpy(ptr, m_string.constData() + m_offset, m_length * 2);
|
||||
ptr += m_length;
|
||||
*this = ProString(neu, NoHash);
|
||||
*this = ProString(neu);
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,10 +52,7 @@ private:
|
||||
};
|
||||
#endif
|
||||
|
||||
namespace ProStringConstants {
|
||||
enum OmitPreHashing { NoHash };
|
||||
}
|
||||
|
||||
class ProKey;
|
||||
class ProStringList;
|
||||
class ProFile;
|
||||
|
||||
@@ -63,16 +60,10 @@ class ProString {
|
||||
public:
|
||||
ProString();
|
||||
ProString(const ProString &other);
|
||||
ProString(const ProString &other, ProStringConstants::OmitPreHashing);
|
||||
explicit ProString(const QString &str);
|
||||
ProString(const QString &str, ProStringConstants::OmitPreHashing);
|
||||
explicit ProString(const char *str);
|
||||
ProString(const char *str, ProStringConstants::OmitPreHashing);
|
||||
ProString(const QString &str, int offset, int length);
|
||||
ProString(const QString &str, int offset, int length, uint hash);
|
||||
ProString(const QString &str, int offset, int length, ProStringConstants::OmitPreHashing);
|
||||
void setValue(const QString &str);
|
||||
void setValue(const QString &str, ProStringConstants::OmitPreHashing);
|
||||
ProString &setSource(const ProString &other) { m_file = other.m_file; return *this; }
|
||||
ProString &setSource(const ProFile *pro) { m_file = pro; return *this; }
|
||||
const ProFile *sourceFile() const { return m_file; }
|
||||
@@ -99,7 +90,22 @@ public:
|
||||
|
||||
static uint hash(const QChar *p, int n);
|
||||
|
||||
ALWAYS_INLINE ProKey &toKey() { return *(ProKey *)this; }
|
||||
ALWAYS_INLINE const ProKey &toKey() const { return *(const ProKey *)this; }
|
||||
|
||||
private:
|
||||
ProString(const ProKey &other);
|
||||
ProString &operator=(const ProKey &other);
|
||||
|
||||
enum OmitPreHashing { NoHash };
|
||||
ProString(const ProString &other, OmitPreHashing);
|
||||
|
||||
enum DoPreHashing { DoHash };
|
||||
ALWAYS_INLINE ProString(const QString &str, DoPreHashing);
|
||||
ALWAYS_INLINE ProString(const char *str, DoPreHashing);
|
||||
ALWAYS_INLINE ProString(const QString &str, int offset, int length, DoPreHashing);
|
||||
ALWAYS_INLINE ProString(const QString &str, int offset, int length, uint hash);
|
||||
|
||||
QString m_string;
|
||||
int m_offset, m_length;
|
||||
const ProFile *m_file;
|
||||
@@ -108,15 +114,33 @@ private:
|
||||
uint updatedHash() const;
|
||||
friend uint qHash(const ProString &str);
|
||||
friend QString operator+(const ProString &one, const ProString &two);
|
||||
friend class ProKey;
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(ProString, Q_MOVABLE_TYPE);
|
||||
|
||||
class ProKey : public ProString {
|
||||
public:
|
||||
ALWAYS_INLINE ProKey() : ProString() {}
|
||||
explicit ProKey(const QString &str);
|
||||
explicit ProKey(const char *str);
|
||||
ProKey(const QString &str, int off, int len);
|
||||
ProKey(const QString &str, int off, int len, uint hash);
|
||||
void setValue(const QString &str);
|
||||
|
||||
ALWAYS_INLINE ProString &toString() { return *(ProString *)this; }
|
||||
ALWAYS_INLINE const ProString &toString() const { return *(const ProString *)this; }
|
||||
|
||||
private:
|
||||
ProKey(const ProString &other);
|
||||
};
|
||||
Q_DECLARE_TYPEINFO(ProKey, Q_MOVABLE_TYPE);
|
||||
|
||||
uint qHash(const ProString &str);
|
||||
QString operator+(const ProString &one, const ProString &two);
|
||||
inline QString operator+(const ProString &one, const QString &two)
|
||||
{ return one + ProString(two, ProStringConstants::NoHash); }
|
||||
{ return one + ProString(two); }
|
||||
inline QString operator+(const QString &one, const ProString &two)
|
||||
{ return ProString(one, ProStringConstants::NoHash) + two; }
|
||||
{ return ProString(one) + two; }
|
||||
|
||||
class ProStringList : public QVector<ProString> {
|
||||
public:
|
||||
@@ -127,7 +151,7 @@ public:
|
||||
QStringList toQStringList() const;
|
||||
};
|
||||
|
||||
typedef QHash<ProString, ProStringList> ProValueMap;
|
||||
typedef QHash<ProKey, ProStringList> ProValueMap;
|
||||
|
||||
// These token definitions affect both ProFileEvaluator and ProWriter
|
||||
enum ProToken {
|
||||
@@ -250,8 +274,8 @@ private:
|
||||
Q_DECLARE_TYPEINFO(ProFunctionDef, Q_MOVABLE_TYPE);
|
||||
|
||||
struct ProFunctionDefs {
|
||||
QHash<ProString, ProFunctionDef> testFunctions;
|
||||
QHash<ProString, ProFunctionDef> replaceFunctions;
|
||||
QHash<ProKey, ProFunctionDef> testFunctions;
|
||||
QHash<ProKey, ProFunctionDef> replaceFunctions;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
@@ -70,9 +70,6 @@ using namespace ProFileEvaluatorInternal;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace ProStringConstants;
|
||||
|
||||
|
||||
#define fL1S(s) QString::fromLatin1(s)
|
||||
|
||||
enum ExpandFunc {
|
||||
@@ -140,7 +137,7 @@ void QMakeEvaluator::initFunctionStatics()
|
||||
{ "shell_quote", E_SHELL_QUOTE },
|
||||
};
|
||||
for (unsigned i = 0; i < sizeof(expandInits)/sizeof(expandInits[0]); ++i)
|
||||
statics.expands.insert(ProString(expandInits[i].name), expandInits[i].func);
|
||||
statics.expands.insert(ProKey(expandInits[i].name), expandInits[i].func);
|
||||
|
||||
static const struct {
|
||||
const char * const name;
|
||||
@@ -181,7 +178,7 @@ void QMakeEvaluator::initFunctionStatics()
|
||||
{ "cache", T_CACHE },
|
||||
};
|
||||
for (unsigned i = 0; i < sizeof(testInits)/sizeof(testInits[0]); ++i)
|
||||
statics.functions.insert(ProString(testInits[i].name), testInits[i].func);
|
||||
statics.functions.insert(ProKey(testInits[i].name), testInits[i].func);
|
||||
}
|
||||
|
||||
static bool isTrue(const ProString &_str, QString &tmp)
|
||||
@@ -371,19 +368,19 @@ QByteArray QMakeEvaluator::getCommandOutput(const QString &args) const
|
||||
|
||||
void QMakeEvaluator::populateDeps(
|
||||
const ProStringList &deps, const ProString &prefix,
|
||||
QHash<ProString, QSet<ProString> > &dependencies, ProValueMap &dependees,
|
||||
QHash<ProKey, QSet<ProKey> > &dependencies, ProValueMap &dependees,
|
||||
ProStringList &rootSet) const
|
||||
{
|
||||
foreach (const ProString &item, deps)
|
||||
if (!dependencies.contains(item)) {
|
||||
QSet<ProString> &dset = dependencies[item]; // Always create entry
|
||||
ProStringList depends = values(ProString(prefix + item + QString::fromLatin1(".depends")));
|
||||
if (!dependencies.contains(item.toKey())) {
|
||||
QSet<ProKey> &dset = dependencies[item.toKey()]; // Always create entry
|
||||
ProStringList depends = values(ProKey(prefix + item + QString::fromLatin1(".depends")));
|
||||
if (depends.isEmpty()) {
|
||||
rootSet << item;
|
||||
} else {
|
||||
foreach (const ProString &dep, depends) {
|
||||
dset.insert(dep);
|
||||
dependees[dep] << item;
|
||||
dset.insert(dep.toKey());
|
||||
dependees[dep.toKey()] << item;
|
||||
}
|
||||
populateDeps(depends, prefix, dependencies, dependees, rootSet);
|
||||
}
|
||||
@@ -391,9 +388,9 @@ void QMakeEvaluator::populateDeps(
|
||||
}
|
||||
|
||||
ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
const ProString &func, const ushort *&tokPtr)
|
||||
const ProKey &func, const ushort *&tokPtr)
|
||||
{
|
||||
QHash<ProString, ProFunctionDef>::ConstIterator it =
|
||||
QHash<ProKey, ProFunctionDef>::ConstIterator it =
|
||||
m_functionDefs.replaceFunctions.constFind(func);
|
||||
if (it != m_functionDefs.replaceFunctions.constEnd())
|
||||
return evaluateFunction(*it, prepareFunctionArgs(tokPtr), 0);
|
||||
@@ -403,7 +400,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
const QString &fn = func.toQString(m_tmp1);
|
||||
const QString &lfn = fn.toLower();
|
||||
if (!fn.isSharedWith(lfn)) {
|
||||
func_t = ExpandFunc(statics.expands.value(ProString(lfn)));
|
||||
func_t = ExpandFunc(statics.expands.value(ProKey(lfn)));
|
||||
if (func_t)
|
||||
deprecationWarning(fL1S("Using uppercased builtin functions is deprecated."));
|
||||
}
|
||||
@@ -451,12 +448,12 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
QRegExp sepRx(sep);
|
||||
foreach (const ProString &str, values(map(var))) {
|
||||
const QString &rstr = str.toQString(m_tmp1).section(sepRx, beg, end);
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? str : ProString(rstr, NoHash).setSource(str));
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? str : ProString(rstr).setSource(str));
|
||||
}
|
||||
} else {
|
||||
foreach (const ProString &str, values(map(var))) {
|
||||
const QString &rstr = str.toQString(m_tmp1).section(sep, beg, end);
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? str : ProString(rstr, NoHash).setSource(str));
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? str : ProString(rstr).setSource(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -539,7 +536,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
outstr.prepend(QString(space, QLatin1Char(' ')));
|
||||
outstr += numstr;
|
||||
}
|
||||
ret += ProString(outstr, NoHash);
|
||||
ret += ProString(outstr);
|
||||
}
|
||||
formfail:
|
||||
break;
|
||||
@@ -575,7 +572,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
const QString &sep = (args.count() == 2) ? args.at(1).toQString(m_tmp1) : statics.field_sep;
|
||||
foreach (const ProString &var, values(map(args.at(0))))
|
||||
foreach (const QString &splt, var.toQString(m_tmp2).split(sep))
|
||||
ret << (splt.isSharedWith(m_tmp2) ? var : ProString(splt, NoHash).setSource(var));
|
||||
ret << (splt.isSharedWith(m_tmp2) ? var : ProString(splt).setSource(var));
|
||||
}
|
||||
break;
|
||||
case E_MEMBER:
|
||||
@@ -644,7 +641,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
if (args.count() != 1)
|
||||
evalError(fL1S("size(var) requires one argument."));
|
||||
else
|
||||
ret.append(ProString(QString::number(values(map(args.at(0))).size()), NoHash));
|
||||
ret.append(ProString(QString::number(values(map(args.at(0))).size())));
|
||||
break;
|
||||
case E_CAT:
|
||||
if (args.count() < 1 || args.count() > 2) {
|
||||
@@ -669,15 +666,15 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
if (qfile.open(QIODevice::ReadOnly)) {
|
||||
QTextStream stream(&qfile);
|
||||
if (blob) {
|
||||
ret += ProString(stream.readAll(), NoHash);
|
||||
ret += ProString(stream.readAll());
|
||||
} else {
|
||||
while (!stream.atEnd()) {
|
||||
if (lines) {
|
||||
ret += ProString(stream.readLine(), NoHash);
|
||||
ret += ProString(stream.readLine());
|
||||
} else {
|
||||
ret += split_value_list(stream.readLine().trimmed());
|
||||
if (!singleLine)
|
||||
ret += ProString("\n", NoHash);
|
||||
ret += ProString("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -705,11 +702,11 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
case E_LIST: {
|
||||
QString tmp;
|
||||
tmp.sprintf(".QMAKE_INTERNAL_TMP_variableName_%d", m_listCount++);
|
||||
ret = ProStringList(ProString(tmp, NoHash));
|
||||
ret = ProStringList(ProString(tmp));
|
||||
ProStringList lst;
|
||||
foreach (const ProString &arg, args)
|
||||
lst += split_value_list(arg.toQString(m_tmp1), arg.sourceFile()); // Relies on deep copy
|
||||
m_valuemapStack.top()[ret.at(0)] = lst;
|
||||
m_valuemapStack.top()[ret.at(0).toKey()] = lst;
|
||||
break; }
|
||||
case E_FIND:
|
||||
if (args.count() != 2) {
|
||||
@@ -745,11 +742,11 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
if (lines) {
|
||||
QTextStream stream(bytes);
|
||||
while (!stream.atEnd())
|
||||
ret += ProString(stream.readLine(), NoHash);
|
||||
ret += ProString(stream.readLine());
|
||||
} else {
|
||||
QString output = QString::fromLocal8Bit(bytes);
|
||||
if (blob) {
|
||||
ret += ProString(output, NoHash);
|
||||
ret += ProString(output);
|
||||
} else {
|
||||
output.replace(QLatin1Char('\t'), QLatin1Char(' '));
|
||||
if (singleLine)
|
||||
@@ -772,7 +769,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
if (args.count() != 1) {
|
||||
evalError(fL1S("reverse(var) requires one argument."));
|
||||
} else {
|
||||
ProStringList var = values(args.at(0));
|
||||
ProStringList var = values(args.at(0).toKey());
|
||||
for (int i = 0; i < var.size() / 2; i++)
|
||||
qSwap(var[i], var[var.size() - i - 1]);
|
||||
ret += var;
|
||||
@@ -811,23 +808,23 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
}
|
||||
}
|
||||
}
|
||||
ret.append(ProString(QString(i_data, i_len), NoHash).setSource(args.at(i)));
|
||||
ret.append(ProString(QString(i_data, i_len)).setSource(args.at(i)));
|
||||
}
|
||||
break;
|
||||
case E_RE_ESCAPE:
|
||||
for (int i = 0; i < args.size(); ++i) {
|
||||
const QString &rstr = QRegExp::escape(args.at(i).toQString(m_tmp1));
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? args.at(i) : ProString(rstr, NoHash).setSource(args.at(i)));
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? args.at(i) : ProString(rstr).setSource(args.at(i)));
|
||||
}
|
||||
break;
|
||||
case E_VAL_ESCAPE:
|
||||
if (args.count() != 1) {
|
||||
evalError(fL1S("val_escape(var) requires one argument."));
|
||||
} else {
|
||||
const ProStringList &vals = values(args.at(0));
|
||||
const ProStringList &vals = values(args.at(0).toKey());
|
||||
ret.reserve(vals.size());
|
||||
foreach (const ProString &str, vals)
|
||||
ret += ProString(quoteValue(str), NoHash);
|
||||
ret += ProString(quoteValue(str));
|
||||
}
|
||||
break;
|
||||
case E_UPPER:
|
||||
@@ -835,7 +832,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
for (int i = 0; i < args.count(); ++i) {
|
||||
QString rstr = args.at(i).toQString(m_tmp1);
|
||||
rstr = (func_t == E_UPPER) ? rstr.toUpper() : rstr.toLower();
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? args.at(i) : ProString(rstr, NoHash).setSource(args.at(i)));
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? args.at(i) : ProString(rstr).setSource(args.at(i)));
|
||||
}
|
||||
break;
|
||||
case E_FILES:
|
||||
@@ -876,7 +873,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
dirs.append(fname + QLatin1Char('/'));
|
||||
}
|
||||
if (regex.exactMatch(qdir[i]))
|
||||
ret += ProString(fname, NoHash).setSource(currentProFile());
|
||||
ret += ProString(fname).setSource(currentProFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -911,7 +908,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
QString rstr = val.toQString(m_tmp1);
|
||||
QString copy = rstr; // Force a detach on modify
|
||||
rstr.replace(before, after);
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? val : ProString(rstr, NoHash).setSource(val));
|
||||
ret << (rstr.isSharedWith(m_tmp1) ? val : ProString(rstr).setSource(val));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -920,19 +917,19 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
if (args.count() < 1 || args.count() > 2) {
|
||||
evalError(fL1S("%1(var, prefix) requires one or two arguments.").arg(func.toQString(m_tmp1)));
|
||||
} else {
|
||||
QHash<ProString, QSet<ProString> > dependencies;
|
||||
QHash<ProKey, QSet<ProKey> > dependencies;
|
||||
ProValueMap dependees;
|
||||
ProStringList rootSet;
|
||||
ProStringList orgList = values(args.at(0));
|
||||
ProStringList orgList = values(args.at(0).toKey());
|
||||
populateDeps(orgList, (args.count() < 2 ? ProString() : args.at(1)),
|
||||
dependencies, dependees, rootSet);
|
||||
for (int i = 0; i < rootSet.size(); ++i) {
|
||||
const ProString &item = rootSet.at(i);
|
||||
if ((func_t == E_RESOLVE_DEPENDS) || orgList.contains(item))
|
||||
ret.prepend(item);
|
||||
foreach (const ProString &dep, dependees[item]) {
|
||||
QSet<ProString> &dset = dependencies[dep];
|
||||
dset.remove(rootSet.at(i)); // *Don't* use 'item' - rootSet may have changed!
|
||||
foreach (const ProString &dep, dependees[item.toKey()]) {
|
||||
QSet<ProKey> &dset = dependencies[dep.toKey()];
|
||||
dset.remove(rootSet.at(i).toKey()); // *Don't* use 'item' - rootSet may have changed!
|
||||
if (dset.isEmpty())
|
||||
rootSet << dep;
|
||||
}
|
||||
@@ -954,12 +951,12 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
} else {
|
||||
QString val = resolvePath(args.at(0).toQString(m_tmp1));
|
||||
if (m_option->source_root.isEmpty()) {
|
||||
ret += ProString(val, NoHash);
|
||||
ret += ProString(val);
|
||||
} else if (val.startsWith(m_option->source_root)
|
||||
&& (val.length() == m_option->source_root.length()
|
||||
|| val.at(m_option->source_root.length()) == QLatin1Char('/'))) {
|
||||
ret += ProString(m_option->build_root + val.mid(m_option->source_root.length()),
|
||||
NoHash).setSource(args.at(0));
|
||||
ret += ProString(m_option->build_root + val.mid(m_option->source_root.length()))
|
||||
.setSource(args.at(0));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -969,7 +966,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
else
|
||||
ret << ProString(QDir::cleanPath(
|
||||
QDir(args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory())
|
||||
.absoluteFilePath(args.at(0).toQString(m_tmp1))), NoHash).setSource(args.at(0));
|
||||
.absoluteFilePath(args.at(0).toQString(m_tmp1)))).setSource(args.at(0));
|
||||
break;
|
||||
case E_RELATIVE_PATH:
|
||||
if (args.count() > 2)
|
||||
@@ -977,14 +974,13 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
else
|
||||
ret << ProString(QDir::cleanPath(
|
||||
QDir(args.count() > 1 ? args.at(1).toQString(m_tmp2) : currentDirectory())
|
||||
.relativeFilePath(args.at(0).toQString(m_tmp1))), NoHash).setSource(args.at(0));
|
||||
.relativeFilePath(args.at(0).toQString(m_tmp1)))).setSource(args.at(0));
|
||||
break;
|
||||
case E_CLEAN_PATH:
|
||||
if (args.count() != 1)
|
||||
evalError(fL1S("clean_path(path) requires one argument."));
|
||||
else
|
||||
ret << ProString(QDir::cleanPath(args.at(0).toQString(m_tmp1)),
|
||||
NoHash).setSource(args.at(0));
|
||||
ret << ProString(QDir::cleanPath(args.at(0).toQString(m_tmp1))).setSource(args.at(0));
|
||||
break;
|
||||
case E_SYSTEM_PATH:
|
||||
if (args.count() != 1) {
|
||||
@@ -996,7 +992,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
#else
|
||||
rstr.replace(QLatin1Char('\\'), QLatin1Char('/'));
|
||||
#endif
|
||||
ret << ProString(rstr, NoHash).setSource(args.at(0));
|
||||
ret << ProString(rstr).setSource(args.at(0));
|
||||
}
|
||||
break;
|
||||
case E_SHELL_PATH:
|
||||
@@ -1008,15 +1004,14 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
rstr.replace(QLatin1Char('/'), QLatin1Char('\\'));
|
||||
else
|
||||
rstr.replace(QLatin1Char('\\'), QLatin1Char('/'));
|
||||
ret << ProString(rstr, NoHash).setSource(args.at(0));
|
||||
ret << ProString(rstr).setSource(args.at(0));
|
||||
}
|
||||
break;
|
||||
case E_SYSTEM_QUOTE:
|
||||
if (args.count() != 1)
|
||||
evalError(fL1S("system_quote(arg) requires one argument."));
|
||||
else
|
||||
ret << ProString(IoUtils::shellQuote(args.at(0).toQString(m_tmp1)),
|
||||
NoHash).setSource(args.at(0));
|
||||
ret << ProString(IoUtils::shellQuote(args.at(0).toQString(m_tmp1))).setSource(args.at(0));
|
||||
break;
|
||||
case E_SHELL_QUOTE:
|
||||
if (args.count() != 1) {
|
||||
@@ -1027,7 +1022,7 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
rstr = IoUtils::shellQuoteWin(rstr);
|
||||
else
|
||||
rstr = IoUtils::shellQuoteUnix(rstr);
|
||||
ret << ProString(rstr, NoHash).setSource(args.at(0));
|
||||
ret << ProString(rstr).setSource(args.at(0));
|
||||
}
|
||||
break;
|
||||
case E_INVALID:
|
||||
@@ -1043,9 +1038,9 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
|
||||
}
|
||||
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
const ProString &function, const ushort *&tokPtr)
|
||||
const ProKey &function, const ushort *&tokPtr)
|
||||
{
|
||||
QHash<ProString, ProFunctionDef>::ConstIterator it =
|
||||
QHash<ProKey, ProFunctionDef>::ConstIterator it =
|
||||
m_functionDefs.testFunctions.constFind(function);
|
||||
if (it != m_functionDefs.testFunctions.constEnd())
|
||||
return evaluateBoolFunction(*it, prepareFunctionArgs(tokPtr), function);
|
||||
@@ -1056,27 +1051,29 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
const ProStringList &args = expandVariableReferences(tokPtr, 5, true);
|
||||
|
||||
switch (func_t) {
|
||||
case T_DEFINED:
|
||||
case T_DEFINED: {
|
||||
if (args.count() < 1 || args.count() > 2) {
|
||||
evalError(fL1S("defined(function, [\"test\"|\"replace\"])"
|
||||
" requires one or two arguments."));
|
||||
return ReturnFalse;
|
||||
}
|
||||
const ProKey &var = args.at(0).toKey();
|
||||
if (args.count() > 1) {
|
||||
if (args[1] == QLatin1String("test")) {
|
||||
return returnBool(m_functionDefs.testFunctions.contains(args[0]));
|
||||
return returnBool(m_functionDefs.testFunctions.contains(var));
|
||||
} else if (args[1] == QLatin1String("replace")) {
|
||||
return returnBool(m_functionDefs.replaceFunctions.contains(args[0]));
|
||||
return returnBool(m_functionDefs.replaceFunctions.contains(var));
|
||||
} else if (args[1] == QLatin1String("var")) {
|
||||
ProValueMap::Iterator it;
|
||||
return returnBool(findValues(args[0], &it));
|
||||
return returnBool(findValues(var, &it));
|
||||
}
|
||||
evalError(fL1S("defined(function, type): unexpected type [%1].")
|
||||
.arg(args.at(1).toQString(m_tmp1)));
|
||||
return ReturnFalse;
|
||||
}
|
||||
return returnBool(m_functionDefs.replaceFunctions.contains(args[0])
|
||||
|| m_functionDefs.testFunctions.contains(args[0]));
|
||||
return returnBool(m_functionDefs.replaceFunctions.contains(var)
|
||||
|| m_functionDefs.testFunctions.contains(var));
|
||||
}
|
||||
case T_RETURN:
|
||||
m_returnValue = args;
|
||||
// It is "safe" to ignore returns - due to qmake brokeness
|
||||
@@ -1093,7 +1090,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
evalError(fL1S("export(variable) requires one argument."));
|
||||
return ReturnFalse;
|
||||
}
|
||||
const ProString &var = map(args.at(0));
|
||||
const ProKey &var = map(args.at(0));
|
||||
for (int i = m_valuemapStack.size(); --i > 0; ) {
|
||||
ProValueMap::Iterator it = m_valuemapStack[i].find(var);
|
||||
if (it != m_valuemapStack.at(i).end()) {
|
||||
@@ -1300,7 +1297,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
}
|
||||
ProValueMap *hsh;
|
||||
ProValueMap::Iterator it;
|
||||
const ProString &var = map(args.at(0));
|
||||
const ProKey &var = map(args.at(0));
|
||||
if (!(hsh = findValues(var, &it)))
|
||||
return ReturnFalse;
|
||||
if (hsh == &m_valuemapStack.top())
|
||||
@@ -1317,7 +1314,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
}
|
||||
ProValueMap *hsh;
|
||||
ProValueMap::Iterator it;
|
||||
const ProString &var = map(args.at(0));
|
||||
const ProKey &var = map(args.at(0));
|
||||
if (!(hsh = findValues(var, &it)))
|
||||
return ReturnFalse;
|
||||
if (m_valuemapStack.size() == 1)
|
||||
@@ -1363,7 +1360,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
it != symbols.constEnd(); ++it) {
|
||||
const QString &ky = it.key().toQString(m_tmp1);
|
||||
if (!ky.startsWith(QLatin1Char('.')))
|
||||
newMap.insert(ProString(parseInto + QLatin1Char('.') + ky), it.value());
|
||||
newMap.insert(ProKey(parseInto + QLatin1Char('.') + ky), it.value());
|
||||
}
|
||||
m_valuemapStack.top() = newMap;
|
||||
}
|
||||
@@ -1474,7 +1471,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
QIODevice::OpenMode mode = QIODevice::Truncate;
|
||||
QString contents;
|
||||
if (args.count() >= 2) {
|
||||
const ProStringList &vals = values(args.at(1));
|
||||
const ProStringList &vals = values(args.at(1).toKey());
|
||||
if (!vals.isEmpty())
|
||||
contents = vals.join(fL1S("\n")) + QLatin1Char('\n');
|
||||
if (args.count() >= 3)
|
||||
@@ -1534,7 +1531,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
bool persist = true;
|
||||
bool super = false;
|
||||
enum { CacheSet, CacheAdd, CacheSub } mode = CacheSet;
|
||||
ProString srcvar;
|
||||
ProKey srcvar;
|
||||
if (args.count() >= 2) {
|
||||
foreach (const ProString &opt, split_value_list(args.at(1).toQString(m_tmp2))) {
|
||||
opt.toQString(m_tmp3);
|
||||
@@ -1554,14 +1551,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
}
|
||||
}
|
||||
if (args.count() >= 3) {
|
||||
srcvar = args.at(2);
|
||||
srcvar = args.at(2).toKey();
|
||||
} else if (mode != CacheSet) {
|
||||
evalError(fL1S("cache(): modes other than 'set' require a source variable."));
|
||||
return ReturnFalse;
|
||||
}
|
||||
}
|
||||
QString varstr;
|
||||
ProString dstvar = args.at(0);
|
||||
ProKey dstvar = args.at(0).toKey();
|
||||
if (!dstvar.isEmpty()) {
|
||||
if (srcvar.isEmpty())
|
||||
srcvar = dstvar;
|
||||
@@ -1639,14 +1636,14 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateConditionalFunction(
|
||||
if (m_superfile.isEmpty()) {
|
||||
m_superfile = m_outputDir + QLatin1String("/.qmake.super");
|
||||
printf("Info: creating super cache file %s\n", qPrintable(m_superfile));
|
||||
valuesRef(ProString("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile, NoHash);
|
||||
valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
|
||||
}
|
||||
fn = m_superfile;
|
||||
} else {
|
||||
if (m_cachefile.isEmpty()) {
|
||||
m_cachefile = m_outputDir + QLatin1String("/.qmake.cache");
|
||||
printf("Info: creating cache file %s\n", qPrintable(m_cachefile));
|
||||
valuesRef(ProString("_QMAKE_CACHE_")) << ProString(m_cachefile, NoHash);
|
||||
valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
|
||||
// We could update m_{source,build}Root and m_featureRoots here, or even
|
||||
// "re-home" our rootEnv, but this doesn't sound too useful - if somebody
|
||||
// wanted qmake to find something in the build directory, he could have
|
||||
|
||||
@@ -64,8 +64,6 @@ using namespace ProFileEvaluatorInternal;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace ProStringConstants;
|
||||
|
||||
#define fL1S(s) QString::fromLatin1(s)
|
||||
|
||||
|
||||
@@ -109,16 +107,16 @@ void QMakeEvaluator::initStatics()
|
||||
statics.field_sep = QLatin1String(" ");
|
||||
statics.strtrue = QLatin1String("true");
|
||||
statics.strfalse = QLatin1String("false");
|
||||
statics.strCONFIG = ProString("CONFIG");
|
||||
statics.strARGS = ProString("ARGS");
|
||||
statics.strCONFIG = ProKey("CONFIG");
|
||||
statics.strARGS = ProKey("ARGS");
|
||||
statics.strDot = QLatin1String(".");
|
||||
statics.strDotDot = QLatin1String("..");
|
||||
statics.strever = QLatin1String("ever");
|
||||
statics.strforever = QLatin1String("forever");
|
||||
statics.strhost_build = QLatin1String("host_build");
|
||||
statics.strTEMPLATE = ProString("TEMPLATE");
|
||||
statics.strTEMPLATE = ProKey("TEMPLATE");
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
statics.strREQUIRES = ProString("REQUIRES");
|
||||
statics.strREQUIRES = ProKey("REQUIRES");
|
||||
#endif
|
||||
|
||||
statics.fakeValue = ProStringList(ProString("_FAKE_")); // It has to have a unique begin() value
|
||||
@@ -150,13 +148,12 @@ void QMakeEvaluator::initStatics()
|
||||
{ "IN_PWD", "PWD" }
|
||||
};
|
||||
for (unsigned i = 0; i < sizeof(mapInits)/sizeof(mapInits[0]); ++i)
|
||||
statics.varMap.insert(ProString(mapInits[i].oldname),
|
||||
ProString(mapInits[i].newname));
|
||||
statics.varMap.insert(ProKey(mapInits[i].oldname), ProKey(mapInits[i].newname));
|
||||
}
|
||||
|
||||
const ProString &QMakeEvaluator::map(const ProString &var)
|
||||
const ProKey &QMakeEvaluator::map(const ProKey &var)
|
||||
{
|
||||
QHash<ProString, ProString>::ConstIterator it = statics.varMap.constFind(var);
|
||||
QHash<ProKey, ProKey>::ConstIterator it = statics.varMap.constFind(var);
|
||||
if (it == statics.varMap.constEnd())
|
||||
return var;
|
||||
deprecationWarning(fL1S("Variable %1 is deprecated; use %2 instead.")
|
||||
@@ -217,17 +214,17 @@ uint QMakeEvaluator::getBlockLen(const ushort *&tokPtr)
|
||||
ProString QMakeEvaluator::getStr(const ushort *&tokPtr)
|
||||
{
|
||||
uint len = *tokPtr++;
|
||||
ProString ret(m_current.pro->items(), tokPtr - m_current.pro->tokPtr(), len, NoHash);
|
||||
ProString ret(m_current.pro->items(), tokPtr - m_current.pro->tokPtr(), len);
|
||||
ret.setSource(m_current.pro);
|
||||
tokPtr += len;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ProString QMakeEvaluator::getHashStr(const ushort *&tokPtr)
|
||||
ProKey QMakeEvaluator::getHashStr(const ushort *&tokPtr)
|
||||
{
|
||||
uint hash = getBlockLen(tokPtr);
|
||||
uint len = *tokPtr++;
|
||||
ProString ret(m_current.pro->items(), tokPtr - m_current.pro->tokPtr(), len, hash);
|
||||
ProKey ret(m_current.pro->items(), tokPtr - m_current.pro->tokPtr(), len, hash);
|
||||
tokPtr += len;
|
||||
return ret;
|
||||
}
|
||||
@@ -283,14 +280,14 @@ ProStringList QMakeEvaluator::split_value_list(const QString &vals, const ProFil
|
||||
}
|
||||
|
||||
if (!parens && quote.isEmpty() && vals_data[x] == SPACE) {
|
||||
ret << ProString(build, NoHash).setSource(source);
|
||||
ret << ProString(build).setSource(source);
|
||||
build.clear();
|
||||
} else {
|
||||
build += vals_data[x];
|
||||
}
|
||||
}
|
||||
if (!build.isEmpty())
|
||||
ret << ProString(build, NoHash).setSource(source);
|
||||
ret << ProString(build).setSource(source);
|
||||
if (parens)
|
||||
deprecationWarning(fL1S("Unmatched parentheses are deprecated."));
|
||||
return ret;
|
||||
@@ -335,7 +332,7 @@ static void replaceInList(ProStringList *varlist,
|
||||
if (val.isEmpty()) {
|
||||
varit = varlist->erase(varit);
|
||||
} else {
|
||||
(*varit).setValue(val, NoHash);
|
||||
(*varit).setValue(val);
|
||||
++varit;
|
||||
}
|
||||
if (!global)
|
||||
@@ -432,7 +429,7 @@ void QMakeEvaluator::evaluateExpression(
|
||||
tok, ret, pending, joined);
|
||||
break;
|
||||
case TokFuncName: {
|
||||
ProString func = getHashStr(tokPtr);
|
||||
const ProKey &func = getHashStr(tokPtr);
|
||||
addStrList(evaluateExpandFunction(func, tokPtr), tok, ret, pending, joined);
|
||||
break; }
|
||||
default:
|
||||
@@ -547,7 +544,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
|
||||
blockLen = getBlockLen(tokPtr);
|
||||
ret = visitProBlock(tokPtr);
|
||||
} else if (okey != or_op) {
|
||||
const ProString &variable = getHashStr(tokPtr);
|
||||
const ProKey &variable = getHashStr(tokPtr);
|
||||
uint exprLen = getBlockLen(tokPtr);
|
||||
const ushort *exprPtr = tokPtr;
|
||||
tokPtr += exprLen;
|
||||
@@ -566,7 +563,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
|
||||
case TokTestDef:
|
||||
case TokReplaceDef:
|
||||
if (m_cumulative || okey != or_op) {
|
||||
const ProString &name = getHashStr(tokPtr);
|
||||
const ProKey &name = getHashStr(tokPtr);
|
||||
blockLen = getBlockLen(tokPtr);
|
||||
visitProFunctionDef(tok, name, tokPtr);
|
||||
} else {
|
||||
@@ -607,7 +604,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
|
||||
skipExpression(tokPtr);
|
||||
okey = false;
|
||||
} else {
|
||||
ret = evaluateConditionalFunction(curr.at(0), tokPtr);
|
||||
ret = evaluateConditionalFunction(curr.at(0).toKey(), tokPtr);
|
||||
switch (ret) {
|
||||
case ReturnTrue: okey = true; break;
|
||||
case ReturnFalse: okey = false; break;
|
||||
@@ -621,7 +618,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
|
||||
if (curr.size() != 1)
|
||||
skipExpression(tokPtr);
|
||||
else
|
||||
evaluateConditionalFunction(curr.at(0), tokPtr);
|
||||
evaluateConditionalFunction(curr.at(0).toKey(), tokPtr);
|
||||
m_skipLevel--;
|
||||
#endif
|
||||
} else {
|
||||
@@ -647,9 +644,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProBlock(
|
||||
|
||||
|
||||
void QMakeEvaluator::visitProFunctionDef(
|
||||
ushort tok, const ProString &name, const ushort *tokPtr)
|
||||
ushort tok, const ProKey &name, const ushort *tokPtr)
|
||||
{
|
||||
QHash<ProString, ProFunctionDef> *hash =
|
||||
QHash<ProKey, ProFunctionDef> *hash =
|
||||
(tok == TokTestDef
|
||||
? &m_functionDefs.testFunctions
|
||||
: &m_functionDefs.replaceFunctions);
|
||||
@@ -657,12 +654,12 @@ void QMakeEvaluator::visitProFunctionDef(
|
||||
}
|
||||
|
||||
QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
|
||||
const ProString &_variable, const ushort *exprPtr, const ushort *tokPtr)
|
||||
const ProKey &_variable, const ushort *exprPtr, const ushort *tokPtr)
|
||||
{
|
||||
VisitReturn ret = ReturnTrue;
|
||||
bool infinite = false;
|
||||
int index = 0;
|
||||
ProString variable;
|
||||
ProKey variable;
|
||||
ProStringList oldVarVal;
|
||||
ProString it_list = expandVariableReferences(exprPtr, 0, true).at(0);
|
||||
if (_variable.isEmpty()) {
|
||||
@@ -675,7 +672,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
|
||||
variable = map(_variable);
|
||||
oldVarVal = values(variable);
|
||||
}
|
||||
ProStringList list = values(it_list);
|
||||
ProStringList list = values(it_list.toKey());
|
||||
if (list.isEmpty()) {
|
||||
if (it_list == statics.strforever) {
|
||||
infinite = true;
|
||||
@@ -690,10 +687,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
|
||||
if (ok) {
|
||||
if (start < end) {
|
||||
for (int i = start; i <= end; i++)
|
||||
list << ProString(QString::number(i), NoHash);
|
||||
list << ProString(QString::number(i));
|
||||
} else {
|
||||
for (int i = start; i >= end; i--)
|
||||
list << ProString(QString::number(i), NoHash);
|
||||
list << ProString(QString::number(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -705,7 +702,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
|
||||
forever {
|
||||
if (infinite) {
|
||||
if (!variable.isEmpty())
|
||||
m_valuemapStack.top()[variable] = ProStringList(ProString(QString::number(index++), NoHash));
|
||||
m_valuemapStack.top()[variable] = ProStringList(ProString(QString::number(index++)));
|
||||
if (index > 1000) {
|
||||
evalError(fL1S("Ran into infinite loop (> 1000 iterations)."));
|
||||
break;
|
||||
@@ -754,7 +751,7 @@ void QMakeEvaluator::visitProVariable(
|
||||
evalError(fL1S("Left hand side of assignment must expand to exactly one word."));
|
||||
return;
|
||||
}
|
||||
const ProString &varName = map(curr.first());
|
||||
const ProKey &varName = map(curr.first());
|
||||
|
||||
if (tok == TokReplace) { // ~=
|
||||
// DEFINES ~= s/a/b/?[gqi]
|
||||
@@ -849,10 +846,10 @@ void QMakeEvaluator::setTemplate()
|
||||
ProStringList &values = valuesRef(statics.strTEMPLATE);
|
||||
if (!m_option->user_template.isEmpty()) {
|
||||
// Don't allow override
|
||||
values = ProStringList(ProString(m_option->user_template, NoHash));
|
||||
values = ProStringList(ProString(m_option->user_template));
|
||||
} else {
|
||||
if (values.isEmpty())
|
||||
values.append(ProString("app", NoHash));
|
||||
values.append(ProString("app"));
|
||||
else
|
||||
values.erase(values.begin() + 1, values.end());
|
||||
}
|
||||
@@ -860,7 +857,7 @@ void QMakeEvaluator::setTemplate()
|
||||
QString val = values.first().toQString(m_tmp1);
|
||||
if (!val.startsWith(m_option->user_template_prefix)) {
|
||||
val.prepend(m_option->user_template_prefix);
|
||||
values = ProStringList(ProString(val, NoHash));
|
||||
values = ProStringList(ProString(val));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -869,34 +866,34 @@ void QMakeEvaluator::loadDefaults()
|
||||
{
|
||||
ProValueMap &vars = m_valuemapStack.top();
|
||||
|
||||
vars[ProString("DIR_SEPARATOR")] << ProString(m_option->dir_sep, NoHash);
|
||||
vars[ProString("DIRLIST_SEPARATOR")] << ProString(m_option->dirlist_sep, NoHash);
|
||||
vars[ProString("_DATE_")] << ProString(QDateTime::currentDateTime().toString(), NoHash);
|
||||
vars[ProKey("DIR_SEPARATOR")] << ProString(m_option->dir_sep);
|
||||
vars[ProKey("DIRLIST_SEPARATOR")] << ProString(m_option->dirlist_sep);
|
||||
vars[ProKey("_DATE_")] << ProString(QDateTime::currentDateTime().toString());
|
||||
if (!m_option->qmake_abslocation.isEmpty())
|
||||
vars[ProString("QMAKE_QMAKE")] << ProString(m_option->qmake_abslocation, NoHash);
|
||||
vars[ProKey("QMAKE_QMAKE")] << ProString(m_option->qmake_abslocation);
|
||||
#if defined(Q_OS_WIN32)
|
||||
vars[ProString("QMAKE_HOST.os")] << ProString("Windows", NoHash);
|
||||
vars[ProKey("QMAKE_HOST.os")] << ProString("Windows");
|
||||
|
||||
DWORD name_length = 1024;
|
||||
wchar_t name[1024];
|
||||
if (GetComputerName(name, &name_length))
|
||||
vars[ProString("QMAKE_HOST.name")] << ProString(QString::fromWCharArray(name), NoHash);
|
||||
vars[ProKey("QMAKE_HOST.name")] << ProString(QString::fromWCharArray(name));
|
||||
|
||||
QSysInfo::WinVersion ver = QSysInfo::WindowsVersion;
|
||||
vars[ProString("QMAKE_HOST.version")] << ProString(QString::number(ver), NoHash);
|
||||
vars[ProKey("QMAKE_HOST.version")] << ProString(QString::number(ver));
|
||||
ProString verStr;
|
||||
switch (ver) {
|
||||
case QSysInfo::WV_Me: verStr = ProString("WinMe", NoHash); break;
|
||||
case QSysInfo::WV_95: verStr = ProString("Win95", NoHash); break;
|
||||
case QSysInfo::WV_98: verStr = ProString("Win98", NoHash); break;
|
||||
case QSysInfo::WV_NT: verStr = ProString("WinNT", NoHash); break;
|
||||
case QSysInfo::WV_2000: verStr = ProString("Win2000", NoHash); break;
|
||||
case QSysInfo::WV_2003: verStr = ProString("Win2003", NoHash); break;
|
||||
case QSysInfo::WV_XP: verStr = ProString("WinXP", NoHash); break;
|
||||
case QSysInfo::WV_VISTA: verStr = ProString("WinVista", NoHash); break;
|
||||
default: verStr = ProString("Unknown", NoHash); break;
|
||||
case QSysInfo::WV_Me: verStr = ProString("WinMe"); break;
|
||||
case QSysInfo::WV_95: verStr = ProString("Win95"); break;
|
||||
case QSysInfo::WV_98: verStr = ProString("Win98"); break;
|
||||
case QSysInfo::WV_NT: verStr = ProString("WinNT"); break;
|
||||
case QSysInfo::WV_2000: verStr = ProString("Win2000"); break;
|
||||
case QSysInfo::WV_2003: verStr = ProString("Win2003"); break;
|
||||
case QSysInfo::WV_XP: verStr = ProString("WinXP"); break;
|
||||
case QSysInfo::WV_VISTA: verStr = ProString("WinVista"); break;
|
||||
default: verStr = ProString("Unknown"); break;
|
||||
}
|
||||
vars[ProString("QMAKE_HOST.version_string")] << verStr;
|
||||
vars[ProKey("QMAKE_HOST.version_string")] << verStr;
|
||||
|
||||
SYSTEM_INFO info;
|
||||
GetSystemInfo(&info);
|
||||
@@ -904,23 +901,23 @@ void QMakeEvaluator::loadDefaults()
|
||||
switch (info.wProcessorArchitecture) {
|
||||
# ifdef PROCESSOR_ARCHITECTURE_AMD64
|
||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
archStr = ProString("x86_64", NoHash);
|
||||
archStr = ProString("x86_64");
|
||||
break;
|
||||
# endif
|
||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||
archStr = ProString("x86", NoHash);
|
||||
archStr = ProString("x86");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_IA64:
|
||||
# ifdef PROCESSOR_ARCHITECTURE_IA32_ON_WIN64
|
||||
case PROCESSOR_ARCHITECTURE_IA32_ON_WIN64:
|
||||
# endif
|
||||
archStr = ProString("IA64", NoHash);
|
||||
archStr = ProString("IA64");
|
||||
break;
|
||||
default:
|
||||
archStr = ProString("Unknown", NoHash);
|
||||
archStr = ProString("Unknown");
|
||||
break;
|
||||
}
|
||||
vars[ProString("QMAKE_HOST.arch")] << archStr;
|
||||
vars[ProKey("QMAKE_HOST.arch")] << archStr;
|
||||
|
||||
# if defined(Q_CC_MSVC) // ### bogus condition, but nobody x-builds for msvc with a different qmake
|
||||
QLatin1Char backslash('\\');
|
||||
@@ -935,18 +932,18 @@ void QMakeEvaluator::loadDefaults()
|
||||
vcBinX86_64.append(QLatin1String("bin\\x86_amd64"));
|
||||
if (paths.contains(vcBin64, Qt::CaseInsensitive)
|
||||
|| paths.contains(vcBinX86_64, Qt::CaseInsensitive))
|
||||
vars[ProString("QMAKE_TARGET.arch")] << ProString("x86_64", NoHash);
|
||||
vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86_64");
|
||||
else
|
||||
vars[ProString("QMAKE_TARGET.arch")] << ProString("x86", NoHash);
|
||||
vars[ProKey("QMAKE_TARGET.arch")] << ProString("x86");
|
||||
# endif
|
||||
#elif defined(Q_OS_UNIX)
|
||||
struct utsname name;
|
||||
if (!uname(&name)) {
|
||||
vars[ProString("QMAKE_HOST.os")] << ProString(name.sysname, NoHash);
|
||||
vars[ProString("QMAKE_HOST.name")] << ProString(QString::fromLocal8Bit(name.nodename), NoHash);
|
||||
vars[ProString("QMAKE_HOST.version")] << ProString(name.release, NoHash);
|
||||
vars[ProString("QMAKE_HOST.version_string")] << ProString(name.version, NoHash);
|
||||
vars[ProString("QMAKE_HOST.arch")] << ProString(name.machine, NoHash);
|
||||
vars[ProKey("QMAKE_HOST.os")] << ProString(name.sysname);
|
||||
vars[ProKey("QMAKE_HOST.name")] << ProString(QString::fromLocal8Bit(name.nodename));
|
||||
vars[ProKey("QMAKE_HOST.version")] << ProString(name.release);
|
||||
vars[ProKey("QMAKE_HOST.version_string")] << ProString(name.version);
|
||||
vars[ProKey("QMAKE_HOST.arch")] << ProString(name.machine);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1040,28 +1037,28 @@ bool QMakeEvaluator::loadSpec()
|
||||
{
|
||||
QMakeEvaluator evaluator(m_option, m_parser, m_handler);
|
||||
if (!m_superfile.isEmpty()) {
|
||||
valuesRef(ProString("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile, NoHash);
|
||||
valuesRef(ProKey("_QMAKE_SUPER_CACHE_")) << ProString(m_superfile);
|
||||
if (!evaluator.evaluateFileDirect(m_superfile, QMakeHandler::EvalConfigFile, LoadProOnly))
|
||||
return false;
|
||||
}
|
||||
if (!m_conffile.isEmpty()) {
|
||||
valuesRef(ProString("_QMAKE_CONF_")) << ProString(m_conffile, NoHash);
|
||||
valuesRef(ProKey("_QMAKE_CONF_")) << ProString(m_conffile);
|
||||
if (!evaluator.evaluateFileDirect(m_conffile, QMakeHandler::EvalConfigFile, LoadProOnly))
|
||||
return false;
|
||||
}
|
||||
if (!m_cachefile.isEmpty()) {
|
||||
valuesRef(ProString("_QMAKE_CACHE_")) << ProString(m_cachefile, NoHash);
|
||||
valuesRef(ProKey("_QMAKE_CACHE_")) << ProString(m_cachefile);
|
||||
if (!evaluator.evaluateFileDirect(m_cachefile, QMakeHandler::EvalConfigFile, LoadProOnly))
|
||||
return false;
|
||||
}
|
||||
if (qmakespec.isEmpty()) {
|
||||
if (!m_hostBuild)
|
||||
qmakespec = evaluator.first(ProString("XQMAKESPEC")).toQString();
|
||||
qmakespec = evaluator.first(ProKey("XQMAKESPEC")).toQString();
|
||||
if (qmakespec.isEmpty())
|
||||
qmakespec = evaluator.first(ProString("QMAKESPEC")).toQString();
|
||||
qmakespec = evaluator.first(ProKey("QMAKESPEC")).toQString();
|
||||
}
|
||||
m_qmakepath = evaluator.values(ProString("QMAKEPATH")).toQStringList();
|
||||
m_qmakefeatures = evaluator.values(ProString("QMAKEFEATURES")).toQStringList();
|
||||
m_qmakepath = evaluator.values(ProKey("QMAKEPATH")).toQStringList();
|
||||
m_qmakefeatures = evaluator.values(ProKey("QMAKEFEATURES")).toQStringList();
|
||||
}
|
||||
|
||||
updateMkspecPaths();
|
||||
@@ -1101,7 +1098,7 @@ bool QMakeEvaluator::loadSpec()
|
||||
const ProString &orig_spec = first(ProString("QMAKESPEC_ORIGINAL"));
|
||||
m_qmakespecFull = orig_spec.isEmpty() ? m_qmakespec : orig_spec.toQString();
|
||||
#endif
|
||||
valuesRef(ProString("QMAKESPEC")) << ProString(m_qmakespecFull, NoHash);
|
||||
valuesRef(ProKey("QMAKESPEC")) << ProString(m_qmakespecFull);
|
||||
m_qmakespecName = IoUtils::fileName(m_qmakespecFull).toString();
|
||||
if (!evaluateFeatureFile(QLatin1String("spec_post.prf")))
|
||||
return false;
|
||||
@@ -1121,10 +1118,10 @@ void QMakeEvaluator::setupProject()
|
||||
{
|
||||
setTemplate();
|
||||
ProValueMap &vars = m_valuemapStack.top();
|
||||
vars[ProString("TARGET")] << ProString(QFileInfo(currentFileName()).baseName(), NoHash);
|
||||
vars[ProString("_PRO_FILE_")] << ProString(currentFileName(), NoHash);
|
||||
vars[ProString("_PRO_FILE_PWD_")] << ProString(currentDirectory(), NoHash);
|
||||
vars[ProString("OUT_PWD")] << ProString(m_outputDir, NoHash);
|
||||
vars[ProKey("TARGET")] << ProString(QFileInfo(currentFileName()).baseName());
|
||||
vars[ProKey("_PRO_FILE_")] << ProString(currentFileName());
|
||||
vars[ProKey("_PRO_FILE_PWD_")] << ProString(currentDirectory());
|
||||
vars[ProKey("OUT_PWD")] << ProString(m_outputDir);
|
||||
}
|
||||
|
||||
void QMakeEvaluator::visitCmdLine(const QString &cmds)
|
||||
@@ -1211,7 +1208,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
||||
|
||||
m_handler->aboutToEval(currentProFile(), pro, type);
|
||||
m_profileStack.push(pro);
|
||||
valuesRef(ProString("PWD")) = ProStringList(ProString(currentDirectory(), NoHash));
|
||||
valuesRef(ProKey("PWD")) = ProStringList(ProString(currentDirectory()));
|
||||
if (flags & LoadPreFiles) {
|
||||
setupProject();
|
||||
|
||||
@@ -1247,7 +1244,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProFile(
|
||||
}
|
||||
}
|
||||
m_profileStack.pop();
|
||||
valuesRef(ProString("PWD")) = ProStringList(ProString(currentDirectory(), NoHash));
|
||||
valuesRef(ProKey("PWD")) = ProStringList(ProString(currentDirectory()));
|
||||
m_handler->doneWithEval(currentProFile());
|
||||
|
||||
return ReturnTrue;
|
||||
@@ -1270,7 +1267,7 @@ void QMakeEvaluator::updateMkspecPaths()
|
||||
if (!m_sourceRoot.isEmpty())
|
||||
ret << m_sourceRoot + concat;
|
||||
|
||||
ret << m_option->propertyValue(ProString("QT_HOST_DATA/get")) + concat;
|
||||
ret << m_option->propertyValue(ProKey("QT_HOST_DATA/get")) + concat;
|
||||
|
||||
ret.removeDuplicates();
|
||||
m_mkspecPaths = ret;
|
||||
@@ -1288,7 +1285,7 @@ void QMakeEvaluator::updateFeaturePaths()
|
||||
|
||||
feature_roots += m_qmakefeatures;
|
||||
|
||||
feature_roots += m_option->propertyValue(ProString("QMAKEFEATURES")).toQString(m_mtmp).split(
|
||||
feature_roots += m_option->propertyValue(ProKey("QMAKEFEATURES")).toQString(m_mtmp).split(
|
||||
m_option->dirlist_sep, QString::SkipEmptyParts);
|
||||
|
||||
QStringList feature_bases;
|
||||
@@ -1319,11 +1316,11 @@ void QMakeEvaluator::updateFeaturePaths()
|
||||
}
|
||||
}
|
||||
|
||||
feature_bases << (m_option->propertyValue(ProString("QT_HOST_DATA/get")).toQString(m_mtmp)
|
||||
feature_bases << (m_option->propertyValue(ProKey("QT_HOST_DATA/get")).toQString(m_mtmp)
|
||||
+ mkspecs_concat);
|
||||
|
||||
foreach (const QString &fb, feature_bases) {
|
||||
foreach (const ProString &sfx, values(ProString("QMAKE_PLATFORM")))
|
||||
foreach (const ProString &sfx, values(ProKey("QMAKE_PLATFORM")))
|
||||
feature_roots << (fb + features_concat + sfx + QLatin1Char('/'));
|
||||
feature_roots << (fb + features_concat);
|
||||
}
|
||||
@@ -1341,10 +1338,10 @@ void QMakeEvaluator::updateFeaturePaths()
|
||||
m_featureRoots = ret;
|
||||
}
|
||||
|
||||
ProString QMakeEvaluator::propertyValue(const ProString &name) const
|
||||
ProString QMakeEvaluator::propertyValue(const ProKey &name) const
|
||||
{
|
||||
if (name == QLatin1String("QMAKE_MKSPECS"))
|
||||
return ProString(m_mkspecPaths.join(m_option->dirlist_sep), NoHash);
|
||||
return ProString(m_mkspecPaths.join(m_option->dirlist_sep));
|
||||
ProString ret = m_option->propertyValue(name);
|
||||
// if (ret.isNull())
|
||||
// evalError(fL1S("Querying unknown property %1").arg(name.toQString(m_mtmp)));
|
||||
@@ -1407,7 +1404,7 @@ bool QMakeEvaluator::isActiveConfig(const QString &config, bool regex)
|
||||
return true;
|
||||
|
||||
// CONFIG variable
|
||||
if (values(statics.strCONFIG).contains(ProString(config, NoHash)))
|
||||
if (values(statics.strCONFIG).contains(ProString(config)))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1474,7 +1471,7 @@ ProStringList QMakeEvaluator::evaluateFunction(
|
||||
ProStringList args;
|
||||
for (int i = 0; i < argumentsList.count(); ++i) {
|
||||
args += argumentsList[i];
|
||||
m_valuemapStack.top()[ProString(QString::number(i+1))] = argumentsList[i];
|
||||
m_valuemapStack.top()[ProKey(QString::number(i+1))] = argumentsList[i];
|
||||
}
|
||||
m_valuemapStack.top()[statics.strARGS] = args;
|
||||
VisitReturn vr = visitProBlock(func.pro(), func.tokPtr());
|
||||
@@ -1537,14 +1534,14 @@ bool QMakeEvaluator::evaluateConditional(const QString &cond, const QString &con
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
void QMakeEvaluator::checkRequirements(const ProStringList &deps)
|
||||
{
|
||||
ProStringList &failed = valuesRef(ProString("QMAKE_FAILED_REQUIREMENTS"));
|
||||
ProStringList &failed = valuesRef(ProKey("QMAKE_FAILED_REQUIREMENTS"));
|
||||
foreach (const ProString &dep, deps)
|
||||
if (!evaluateConditional(dep.toQString(), fL1S("(requires)")))
|
||||
failed << dep;
|
||||
}
|
||||
#endif
|
||||
|
||||
ProValueMap *QMakeEvaluator::findValues(const ProString &variableName, ProValueMap::Iterator *rit)
|
||||
ProValueMap *QMakeEvaluator::findValues(const ProKey &variableName, ProValueMap::Iterator *rit)
|
||||
{
|
||||
for (int i = m_valuemapStack.size(); --i >= 0; ) {
|
||||
ProValueMap::Iterator it = m_valuemapStack[i].find(variableName);
|
||||
@@ -1558,7 +1555,7 @@ ProValueMap *QMakeEvaluator::findValues(const ProString &variableName, ProValueM
|
||||
return 0;
|
||||
}
|
||||
|
||||
ProStringList &QMakeEvaluator::valuesRef(const ProString &variableName)
|
||||
ProStringList &QMakeEvaluator::valuesRef(const ProKey &variableName)
|
||||
{
|
||||
ProValueMap::Iterator it = m_valuemapStack.top().find(variableName);
|
||||
if (it != m_valuemapStack.top().end()) {
|
||||
@@ -1578,7 +1575,7 @@ ProStringList &QMakeEvaluator::valuesRef(const ProString &variableName)
|
||||
return m_valuemapStack.top()[variableName];
|
||||
}
|
||||
|
||||
ProStringList QMakeEvaluator::values(const ProString &variableName) const
|
||||
ProStringList QMakeEvaluator::values(const ProKey &variableName) const
|
||||
{
|
||||
for (int i = m_valuemapStack.size(); --i >= 0; ) {
|
||||
ProValueMap::ConstIterator it = m_valuemapStack.at(i).constFind(variableName);
|
||||
@@ -1591,7 +1588,7 @@ ProStringList QMakeEvaluator::values(const ProString &variableName) const
|
||||
return ProStringList();
|
||||
}
|
||||
|
||||
ProString QMakeEvaluator::first(const ProString &variableName) const
|
||||
ProString QMakeEvaluator::first(const ProKey &variableName) const
|
||||
{
|
||||
const ProStringList &vals = values(variableName);
|
||||
if (!vals.isEmpty())
|
||||
@@ -1609,8 +1606,8 @@ bool QMakeEvaluator::evaluateFileDirect(
|
||||
pro->deref();
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
if (ok) {
|
||||
ProStringList &iif = m_valuemapStack.first()[ProString("QMAKE_INTERNAL_INCLUDED_FILES")];
|
||||
ProString ifn(fileName, NoHash);
|
||||
ProStringList &iif = m_valuemapStack.first()[ProKey("QMAKE_INTERNAL_INCLUDED_FILES")];
|
||||
ProString ifn(fileName);
|
||||
if (!iif.contains(ifn))
|
||||
iif << ifn;
|
||||
}
|
||||
@@ -1670,8 +1667,8 @@ bool QMakeEvaluator::evaluateFeatureFile(const QString &fileName, bool silent)
|
||||
return false;
|
||||
|
||||
cool:
|
||||
ProStringList &already = valuesRef(ProString("QMAKE_INTERNAL_INCLUDED_FEATURES"));
|
||||
ProString afn(fn, NoHash);
|
||||
ProStringList &already = valuesRef(ProKey("QMAKE_INTERNAL_INCLUDED_FEATURES"));
|
||||
ProString afn(fn);
|
||||
if (already.contains(afn)) {
|
||||
if (!silent)
|
||||
languageWarning(fL1S("Feature %1 already included").arg(fileName));
|
||||
@@ -1702,7 +1699,7 @@ bool QMakeEvaluator::evaluateFileInto(const QString &fileName, QMakeHandler::Eva
|
||||
return false;
|
||||
*values = visitor.m_valuemapStack.top();
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
ProString qiif("QMAKE_INTERNAL_INCLUDED_FILES");
|
||||
ProKey qiif("QMAKE_INTERNAL_INCLUDED_FILES");
|
||||
ProStringList &iif = m_valuemapStack.first()[qiif];
|
||||
foreach (const ProString &ifn, values->value(qiif))
|
||||
if (!iif.contains(ifn))
|
||||
|
||||
@@ -89,10 +89,10 @@ public:
|
||||
QMakeHandler *handler);
|
||||
~QMakeEvaluator();
|
||||
|
||||
ProStringList values(const ProString &variableName) const;
|
||||
ProStringList &valuesRef(const ProString &variableName);
|
||||
ProString first(const ProString &variableName) const;
|
||||
ProString propertyValue(const ProString &val) const;
|
||||
ProStringList values(const ProKey &variableName) const;
|
||||
ProStringList &valuesRef(const ProKey &variableName);
|
||||
ProString first(const ProKey &variableName) const;
|
||||
ProString propertyValue(const ProKey &val) const;
|
||||
|
||||
enum VisitReturn {
|
||||
ReturnFalse,
|
||||
@@ -108,7 +108,7 @@ public:
|
||||
|
||||
static ALWAYS_INLINE uint getBlockLen(const ushort *&tokPtr);
|
||||
ProString getStr(const ushort *&tokPtr);
|
||||
ProString getHashStr(const ushort *&tokPtr);
|
||||
ProKey getHashStr(const ushort *&tokPtr);
|
||||
void evaluateExpression(const ushort *&tokPtr, ProStringList *ret, bool joined);
|
||||
static ALWAYS_INLINE void skipStr(const ushort *&tokPtr);
|
||||
static ALWAYS_INLINE void skipHashStr(const ushort *&tokPtr);
|
||||
@@ -124,13 +124,14 @@ public:
|
||||
LoadFlags flags);
|
||||
VisitReturn visitProBlock(ProFile *pro, const ushort *tokPtr);
|
||||
VisitReturn visitProBlock(const ushort *tokPtr);
|
||||
VisitReturn visitProLoop(const ProString &variable, const ushort *exprPtr,
|
||||
VisitReturn visitProLoop(const ProKey &variable, const ushort *exprPtr,
|
||||
const ushort *tokPtr);
|
||||
void visitProFunctionDef(ushort tok, const ProString &name, const ushort *tokPtr);
|
||||
void visitProFunctionDef(ushort tok, const ProKey &name, const ushort *tokPtr);
|
||||
void visitProVariable(ushort tok, const ProStringList &curr, const ushort *&tokPtr);
|
||||
|
||||
const ProString &map(const ProString &var);
|
||||
ProValueMap *findValues(const ProString &variableName, ProValueMap::Iterator *it);
|
||||
ALWAYS_INLINE const ProKey &map(const ProString &var) { return map(var.toKey()); }
|
||||
const ProKey &map(const ProKey &var);
|
||||
ProValueMap *findValues(const ProKey &variableName, ProValueMap::Iterator *it);
|
||||
|
||||
void setTemplate();
|
||||
|
||||
@@ -167,8 +168,8 @@ public:
|
||||
const QList<ProStringList> &argumentsList,
|
||||
const ProString &function);
|
||||
|
||||
ProStringList evaluateExpandFunction(const ProString &function, const ushort *&tokPtr);
|
||||
VisitReturn evaluateConditionalFunction(const ProString &function, const ushort *&tokPtr);
|
||||
ProStringList evaluateExpandFunction(const ProKey &function, const ushort *&tokPtr);
|
||||
VisitReturn evaluateConditionalFunction(const ProKey &function, const ushort *&tokPtr);
|
||||
|
||||
bool evaluateConditional(const QString &cond, const QString &context);
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
@@ -182,7 +183,7 @@ public:
|
||||
|
||||
void populateDeps(
|
||||
const ProStringList &deps, const ProString &prefix,
|
||||
QHash<ProString, QSet<ProString> > &dependencies,
|
||||
QHash<ProKey, QSet<ProKey> > &dependencies,
|
||||
ProValueMap &dependees, ProStringList &rootSet) const;
|
||||
|
||||
VisitReturn writeFile(const QString &ctx, const QString &fn, QIODevice::OpenMode mode,
|
||||
|
||||
@@ -43,20 +43,20 @@ struct QMakeStatics {
|
||||
QString field_sep;
|
||||
QString strtrue;
|
||||
QString strfalse;
|
||||
ProString strCONFIG;
|
||||
ProString strARGS;
|
||||
ProKey strCONFIG;
|
||||
ProKey strARGS;
|
||||
QString strDot;
|
||||
QString strDotDot;
|
||||
QString strever;
|
||||
QString strforever;
|
||||
QString strhost_build;
|
||||
ProString strTEMPLATE;
|
||||
ProKey strTEMPLATE;
|
||||
#ifdef PROEVALUATOR_FULL
|
||||
ProString strREQUIRES;
|
||||
ProKey strREQUIRES;
|
||||
#endif
|
||||
QHash<ProString, int> expands;
|
||||
QHash<ProString, int> functions;
|
||||
QHash<ProString, ProString> varMap;
|
||||
QHash<ProKey, int> expands;
|
||||
QHash<ProKey, int> functions;
|
||||
QHash<ProKey, ProKey> varMap;
|
||||
ProStringList fakeValue;
|
||||
};
|
||||
|
||||
|
||||
@@ -229,25 +229,25 @@ bool QMakeGlobals::initProperties()
|
||||
line.chop(1);
|
||||
QString name = QString::fromLatin1(line.left(off));
|
||||
ProString value = ProString(QDir::fromNativeSeparators(
|
||||
QString::fromLocal8Bit(line.mid(off + 1))), ProStringConstants::NoHash);
|
||||
properties.insert(ProString(name), value);
|
||||
QString::fromLocal8Bit(line.mid(off + 1))));
|
||||
properties.insert(ProKey(name), value);
|
||||
if (name.startsWith(QLatin1String("QT_")) && !name.contains(QLatin1Char('/'))) {
|
||||
if (name.startsWith(QLatin1String("QT_INSTALL_"))) {
|
||||
properties.insert(ProString(name + QLatin1String("/raw")), value);
|
||||
properties.insert(ProString(name + QLatin1String("/get")), value);
|
||||
properties.insert(ProKey(name + QLatin1String("/raw")), value);
|
||||
properties.insert(ProKey(name + QLatin1String("/get")), value);
|
||||
if (name == QLatin1String("QT_INSTALL_PREFIX")
|
||||
|| name == QLatin1String("QT_INSTALL_DATA")
|
||||
|| name == QLatin1String("QT_INSTALL_BINS")) {
|
||||
name.replace(3, 7, QLatin1String("HOST"));
|
||||
properties.insert(ProString(name), value);
|
||||
properties.insert(ProString(name + QLatin1String("/get")), value);
|
||||
properties.insert(ProKey(name), value);
|
||||
properties.insert(ProKey(name + QLatin1String("/get")), value);
|
||||
}
|
||||
} else if (name.startsWith(QLatin1String("QT_HOST_"))) {
|
||||
properties.insert(ProString(name + QLatin1String("/get")), value);
|
||||
properties.insert(ProKey(name + QLatin1String("/get")), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
properties.insert(ProString("QMAKE_VERSION"), ProString("2.01a", ProStringConstants::NoHash));
|
||||
properties.insert(ProKey("QMAKE_VERSION"), ProString("2.01a"));
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
@@ -255,7 +255,7 @@ void QMakeGlobals::setProperties(const QHash<QString, QString> &props)
|
||||
{
|
||||
QHash<QString, QString>::ConstIterator it = props.constBegin(), eit = props.constEnd();
|
||||
for (; it != eit; ++it)
|
||||
properties.insert(ProString(it.key()), ProString(it.value(), ProStringConstants::NoHash));
|
||||
properties.insert(ProKey(it.key()), ProString(it.value()));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
#else
|
||||
void setProperties(const QHash<QString, QString> &props);
|
||||
#endif
|
||||
ProString propertyValue(const ProString &name) const { return properties.value(name); }
|
||||
ProString propertyValue(const ProKey &name) const { return properties.value(name); }
|
||||
|
||||
QString expandEnvVars(const QString &str) const;
|
||||
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
QString source_root, build_root;
|
||||
|
||||
QString precmds, postcmds;
|
||||
QHash<ProString, ProString> properties;
|
||||
QHash<ProKey, ProString> properties;
|
||||
|
||||
#ifdef PROEVALUATOR_THREAD_SAFE
|
||||
QMutex mutex;
|
||||
|
||||
Reference in New Issue
Block a user