diff options
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/project.cpp | 131 | ||||
-rw-r--r-- | qmake/project.h | 11 | ||||
-rw-r--r-- | qmake/qmake.pri | 3 | ||||
-rw-r--r-- | qmake/qmake.pro | 6 |
4 files changed, 3 insertions, 148 deletions
diff --git a/qmake/project.cpp b/qmake/project.cpp index 4fefbab..e44c6c7 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -153,91 +153,6 @@ QMap<QString, TestFunc> qmake_testFunctions() return *qmake_test_functions; } -QT_END_NAMESPACE - -#ifdef QTSCRIPT_SUPPORT -#include "qscriptvalue.h" -#include "qscriptengine.h" -#include "qscriptvalueiterator.h" - -QT_BEGIN_NAMESPACE - -static QScriptValue qscript_projectWrapper(QScriptEngine *eng, QMakeProject *project, - const QMap<QString, QStringList> &place); - -static bool qscript_createQMakeProjectMap(QMap<QString, QStringList> &vars, QScriptValue js) -{ - QScriptValueIterator it(js); - while(it.hasNext()) { - it.next(); - vars[it.name()] = qscriptvalue_cast<QStringList>(it.value()); - } - return true; -} - -static QScriptValue qscript_call_testfunction(QScriptContext *context, QScriptEngine *engine) -{ - QMakeProject *self = qscriptvalue_cast<QMakeProject*>(context->callee().property("qmakeProject")); - QString func = context->callee().property("functionName").toString(); - QStringList args; - for(int i = 0; i < context->argumentCount(); ++i) - args += context->argument(i).toString(); - QMap<QString, QStringList> place = self->variables(); - qscript_createQMakeProjectMap(place, engine->globalObject().property("qmake")); - QScriptValue ret(engine, self->doProjectTest(func, args, place)); - engine->globalObject().setProperty("qmake", qscript_projectWrapper(engine, self, place)); - return ret; -} - -static QScriptValue qscript_call_expandfunction(QScriptContext *context, QScriptEngine *engine) -{ - QMakeProject *self = qscriptvalue_cast<QMakeProject*>(context->callee().property("qmakeProject")); - QString func = context->callee().property("functionName").toString(); - QStringList args; - for(int i = 0; i < context->argumentCount(); ++i) - args += context->argument(i).toString(); - QMap<QString, QStringList> place = self->variables(); - qscript_createQMakeProjectMap(place, engine->globalObject().property("qmake")); - QScriptValue ret = qScriptValueFromValue(engine, self->doProjectExpand(func, args, place)); - engine->globalObject().setProperty("qmake", qscript_projectWrapper(engine, self, place)); - return ret; -} - -static QScriptValue qscript_projectWrapper(QScriptEngine *eng, QMakeProject *project, - const QMap<QString, QStringList> &place) -{ - QScriptValue ret = eng->newObject(); - { - QStringList testFuncs = qmake_testFunctions().keys() + project->userTestFunctions(); - for(int i = 0; i < testFuncs.size(); ++i) { - QString funcName = testFuncs.at(i); - QScriptValue fun = eng->newFunction(qscript_call_testfunction); - fun.setProperty("qmakeProject", eng->newVariant(qVariantFromValue(project))); - fun.setProperty("functionName", QScriptValue(eng, funcName)); - eng->globalObject().setProperty(funcName, fun); - } - } - { - QStringList testFuncs = qmake_expandFunctions().keys() + project->userExpandFunctions(); - for(int i = 0; i < testFuncs.size(); ++i) { - QString funcName = testFuncs.at(i); - QScriptValue fun = eng->newFunction(qscript_call_expandfunction); - fun.setProperty("qmakeProject", eng->newVariant(qVariantFromValue(project))); - fun.setProperty("functionName", QScriptValue(eng, funcName)); - eng->globalObject().setProperty(funcName, fun); - } - } - for(QMap<QString, QStringList>::ConstIterator it = place.begin(); it != place.end(); ++it) - ret.setProperty(it.key(), qScriptValueFromValue(eng, it.value())); - return ret; -} - -QT_END_NAMESPACE - -#endif - -QT_BEGIN_NAMESPACE - struct parser_info { QString file; int line_no; @@ -1797,27 +1712,8 @@ QMakeProject::doProjectInclude(QString file, uchar flags, QMap<QString, QStringL bool parsed = false; parser_info pi = parser; if(format == JSFormat) { -#ifdef QTSCRIPT_SUPPORT - eng.globalObject().setProperty("qmake", qscript_projectWrapper(&eng, this, place)); - QFile f(file); - if (f.open(QFile::ReadOnly)) { - QString code = f.readAll(); - QScriptValue r = eng.evaluate(code); - if(eng.hasUncaughtException()) { - const int lineNo = eng.uncaughtExceptionLineNumber(); - fprintf(stderr, "%s:%d: %s\n", file.toLatin1().constData(), lineNo, - r.toString().toLatin1().constData()); - } else { - parsed = true; - QScriptValue variables = eng.globalObject().property("qmake"); - if (variables.isValid() && variables.isObject()) - qscript_createQMakeProjectMap(place, variables); - } - } -#else warn_msg(WarnParser, "%s:%d: QtScript support disabled for %s.", pi.file.toLatin1().constData(), pi.line_no, orig_file.toLatin1().constData()); -#endif } else { QStack<ScopeBlock> sc = scope_blocks; IteratorBlock *it = iterator; @@ -2306,19 +2202,6 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list, } break; } default: { -#ifdef QTSCRIPT_SUPPORT - { - QScriptValue jsFunc = eng.globalObject().property(func); - if(jsFunc.isFunction()) { - QScriptValueList jsArgs; - for(int i = 0; i < args.size(); ++i) - jsArgs += QScriptValue(&eng, args.at(i)); - QScriptValue jsRet = jsFunc.call(eng.globalObject(), jsArgs); - ret = qscriptvalue_cast<QStringList>(jsRet); - break; - } - } -#endif fprintf(stderr, "%s:%d: Unknown replace function: %s\n", parser.file.toLatin1().constData(), parser.line_no, func.toLatin1().constData()); @@ -2782,20 +2665,6 @@ QMakeProject::doProjectTest(QString func, QList<QStringList> args_list, QMap<QSt #endif return true; } default: -#ifdef QTSCRIPT_SUPPORT - { - QScriptValue jsFunc = eng.globalObject().property(func); - if(jsFunc.isFunction()) { - QScriptValueList jsArgs; - for(int i = 0; i < args.size(); ++i) - jsArgs += QScriptValue(&eng, args.at(i)); - QScriptValue jsRet = jsFunc.call(eng.globalObject(), jsArgs); - if(eng.hasUncaughtException()) - return false; - return qscriptvalue_cast<bool>(jsRet); - } - } -#endif fprintf(stderr, "%s:%d: Unknown test function: %s\n", parser.file.toLatin1().constData(), parser.line_no, func.toLatin1().constData()); } diff --git a/qmake/project.h b/qmake/project.h index 6850782..3e455ac 100644 --- a/qmake/project.h +++ b/qmake/project.h @@ -49,14 +49,6 @@ #include <qmap.h> #include <qmetatype.h> -#ifndef QT_BUILD_QMAKE_LIBRARY -//# define QTSCRIPT_SUPPORT -#endif - -#ifdef QTSCRIPT_SUPPORT -# include <qscriptengine.h> -#endif - QT_BEGIN_NAMESPACE class QMakeProperty; @@ -80,9 +72,6 @@ class QMakeProject friend struct IteratorBlock; friend struct FunctionBlock; -#ifdef QTSCRIPT_SUPPORT - QScriptEngine eng; -#endif QStack<ScopeBlock> scope_blocks; QStack<FunctionBlock *> function_blocks; IteratorBlock *iterator; diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 1f9243b..f5f675c 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -120,10 +120,9 @@ bootstrap { #Qt code LFLAGS += -lcpp } DEFINES *= QT_NO_QOBJECT - include($$QT_SOURCE_TREE/src/script/script.pri) } else { CONFIG += qt - QT = core script + QT = core } *-g++:profiling { QMAKE_CFLAGS = -pg diff --git a/qmake/qmake.pro b/qmake/qmake.pro index 5740061..a044d47 100644 --- a/qmake/qmake.pro +++ b/qmake/qmake.pro @@ -17,10 +17,8 @@ VPATH += $$QT_SOURCE_TREE/src/corelib/global \ $$QT_SOURCE_TREE/src/corelib/kernel \ $$QT_SOURCE_TREE/src/corelib/codecs \ $$QT_SOURCE_TREE/src/corelib/plugin \ - $$QT_SOURCE_TREE/src/corelib/io \ - $$QT_SOURCE_TREE/src/script + $$QT_SOURCE_TREE/src/corelib/io INCPATH += generators generators/unix generators/win32 generators/mac \ - $$QT_SOURCE_TREE/include $$QT_SOURCE_TREE/include/QtCore \ - $$QT_SOURCE_TREE/qmake $$QT_SOURCE_TREE/include/QtScript + $$QT_SOURCE_TREE/include $$QT_SOURCE_TREE/include/QtCore include(qmake.pri) |