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