Git commit 6ea52ee54d15336c20880d0f7b390ef08f9032e2 by Arno Rehn. Committed on 08/06/2013 at 18:59. Pushed by arnorehn into branch 'master'. Revert "Removed repeating in each module static functions of their core dep= endency." This reverts commit 2ef3cf12139bb303cf3a63fd97364f514c86f125. M +1 -1 generators/smoke/CMakeLists.txt M +1 -79 generators/smoke/helpers.cpp http://commits.kde.org/smokegen/6ea52ee54d15336c20880d0f7b390ef08f9032e2 diff --git a/generators/smoke/CMakeLists.txt b/generators/smoke/CMakeLists.= txt index b83628f..a49573a 100644 --- a/generators/smoke/CMakeLists.txt +++ b/generators/smoke/CMakeLists.txt @@ -7,7 +7,7 @@ set(generator_smoke_SRC helpers.cpp) = add_library(generator_smoke MODULE ${generator_smoke_SRC}) -target_link_libraries(generator_smoke smokebase ${QT_QTCORE_LIBRARY} ${QT_= QTXML_LIBRARY} smokegen) +target_link_libraries(generator_smoke ${QT_QTCORE_LIBRARY} ${QT_QTXML_LIBR= ARY} smokegen) set_target_properties(generator_smoke PROPERTIES PREFIX "") = if (WIN32) diff --git a/generators/smoke/helpers.cpp b/generators/smoke/helpers.cpp index 90d73fc..43c6844 100644 --- a/generators/smoke/helpers.cpp +++ b/generators/smoke/helpers.cpp @@ -17,20 +17,15 @@ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ = -#include #include #include -#include #include = #include -#include = #include "globals.h" #include "../../options.h" = -typedef void (*InitSmokeFn)(); - QHash Util::typeMap; QHash Util::globalFunctionMap; QHash Util::fieldAccessors; @@ -97,79 +92,13 @@ bool operator=3D=3D(const EnumMember& lhs, const EnumMe= mber& rhs) return (lhs.name() =3D=3D rhs.name() && lhs.declaringType() =3D=3D rhs= .declaringType() && lhs.type() =3D=3D rhs.type()); } = -static Smoke* loadSmokeModule(QString moduleName) { -#if defined(Q_OS_WIN32) - QFileInfo file(QString("smoke") + moduleName); -#else - QFileInfo file(QString("libsmoke") + moduleName); -#endif - QLibrary lib(file.filePath()); - - QString init_name =3D "init_" + moduleName + "_Smoke"; - InitSmokeFn init =3D (InitSmokeFn) lib.resolve(init_name.toLatin1()); - - if (!init) - qFatal("Couldn't resolve %s: %s", qPrintable(init_name), qPrintabl= e(lib.errorString())); - - (*init)(); - - QString smoke_name =3D moduleName + "_Smoke"; - Smoke** smoke =3D (Smoke**) lib.resolve(smoke_name.toLatin1()); - if (!smoke) - qFatal("Couldn't resolve %s: %s", qPrintable(smoke_name), qPrintab= le(lib.errorString())); - - return *smoke; -} - -static bool compareArgs(const Method& method, const Smoke::Method& smokeMe= thod, Smoke* smoke) { - if (method.parameters().count() !=3D smokeMethod.numArgs) { - return false; - } - for (int i =3D 0; i < method.parameters().count(); i++) { - Parameter p =3D method.parameters()[i]; - if (p.type()->toString() !=3D smoke->types[smoke->argumentList[smo= keMethod.args + i]].name) { - return false; - } - } - return true; -} - -static bool isRepeating(const QList& parentModules, const char* cl= assName, const Method& method) { - const char* mungedName =3D Util::mungedName(method).toLatin1(); - foreach (Smoke* smoke, parentModules) { - Smoke::ModuleIndex methodIndex =3D smoke->findMethod(className, mu= ngedName); - if (methodIndex.index) { - Smoke::Index index =3D smoke->methodMaps[methodIndex.index].me= thod; - if (index >=3D 0) { - if (compareArgs(method, smoke->methods[index], smoke)) { - return true; - } - continue; - } - index =3D -index; - Smoke::Index i; - while ((i =3D smoke->ambiguousMethodList[index++]) !=3D 0) { - if (compareArgs(method, smoke->methods[i], smoke)) { - return true; - } - } - } - } - return false; -} - void Util::preparse(QSet *usedTypes, QSet *superClass= es, const QList& keys) { Class& globalSpace =3D classes["QGlobalSpace"]; globalSpace.setName("QGlobalSpace"); globalSpace.setKind(Class::Kind_Class); globalSpace.setIsNameSpace(true); - - QList parentModules; - foreach (QString module, Options::parentModules) { - parentModules << loadSmokeModule(module); - } - + = // add all functions as methods to a class called 'QGlobalSpace' or a = class that represents a namespace for (QHash::const_iterator it =3D functions.constBe= gin(); it !=3D functions.constEnd(); it++) { const Function& fn =3D it.value(); @@ -198,9 +127,6 @@ void Util::preparse(QSet *usedTypes, QSet *superClasses, co = Method meth =3D Method(parent, fn.name(), fn.type(), Access_public= , fn.parameters()); meth.setFlag(Method::Static); - if (isRepeating(parentModules, parent->name().toLatin1(), meth)) { - continue; - } parent->appendMethod(meth); // map this method to the function, so we can later retrieve the h= eader it was defined in globalFunctionMap[&parent->methods().last()] =3D &fn; @@ -215,10 +141,6 @@ void Util::preparse(QSet *usedTypes, QSet *superClasses, co foreach (const Parameter& param, meth.parameters()) (*usedTypes) << param.type(); } - - foreach (Smoke* smoke, parentModules) { - delete smoke; - } = // all enums that don't have a parent are put under QGlobalSpace, too for (QHash::iterator it =3D enums.begin(); it !=3D enum= s.end(); it++) {