[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [smokegen] generators/smoke: Revert "Removed repeating in each module static functions of their core
From:       Arno Rehn <arno () arnorehn ! de>
Date:       2013-06-10 11:22:24
Message-ID: 20130610112224.5B766A6063 () git ! kde ! org
[Download RAW message or body]

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 dependency."

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_LIBRARY} 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 <QFileInfo>
 #include <QHash>
 #include <QList>
-#include <QLibrary>
 #include <QStack>
 
 #include <type.h>
-#include <smoke.h>
 
 #include "globals.h"
 #include "../../options.h"
 
-typedef void (*InitSmokeFn)();
-
 QHash<QString, QString> Util::typeMap;
 QHash<const Method*, const Function*> Util::globalFunctionMap;
 QHash<const Method*, const Field*> Util::fieldAccessors;
@@ -97,79 +92,13 @@ bool operator==(const EnumMember& lhs, const EnumMember& rhs)
     return (lhs.name() == rhs.name() && lhs.declaringType() == rhs.declaringType() \
&& lhs.type() == 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 = "init_" + moduleName + "_Smoke";
-    InitSmokeFn init = (InitSmokeFn) lib.resolve(init_name.toLatin1());
-
-    if (!init)
-        qFatal("Couldn't resolve %s: %s", qPrintable(init_name), \
                qPrintable(lib.errorString()));
-
-    (*init)();
-
-    QString smoke_name = moduleName + "_Smoke";
-    Smoke** smoke = (Smoke**) lib.resolve(smoke_name.toLatin1());
-    if (!smoke)
-        qFatal("Couldn't resolve %s: %s", qPrintable(smoke_name), \
                qPrintable(lib.errorString()));
-
-    return *smoke;
-}
-
-static bool compareArgs(const Method& method, const Smoke::Method& smokeMethod, \
                Smoke* smoke) {
-    if (method.parameters().count() != smokeMethod.numArgs) {
-        return false;
-    }
-    for (int i = 0; i < method.parameters().count(); i++) {
-        Parameter p = method.parameters()[i];
-        if (p.type()->toString() != \
                smoke->types[smoke->argumentList[smokeMethod.args + i]].name) {
-            return false;
-        }
-    }
-    return true;
-}
-
-static bool isRepeating(const QList<Smoke*>& parentModules, const char* className, \
                const Method& method) {
-    const char* mungedName = Util::mungedName(method).toLatin1();
-    foreach (Smoke* smoke, parentModules) {
-        Smoke::ModuleIndex methodIndex = smoke->findMethod(className, mungedName);
-        if (methodIndex.index) {
-            Smoke::Index index = smoke->methodMaps[methodIndex.index].method;
-            if (index >= 0) {
-                if (compareArgs(method, smoke->methods[index], smoke)) {
-                    return true;
-                }
-                continue;
-            }
-            index = -index;
-            Smoke::Index i;
-            while ((i = smoke->ambiguousMethodList[index++]) != 0) {
-                if (compareArgs(method, smoke->methods[i], smoke)) {
-                    return true;
-                }
-            }
-        }
-    }
-    return false;
-}
-
 void Util::preparse(QSet<Type*> *usedTypes, QSet<const Class*> *superClasses, const \
QList<QString>& keys)  {
     Class& globalSpace = classes["QGlobalSpace"];
     globalSpace.setName("QGlobalSpace");
     globalSpace.setKind(Class::Kind_Class);
     globalSpace.setIsNameSpace(true);
-
-    QList<Smoke*> 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<QString, Function>::const_iterator it = functions.constBegin(); it != \
functions.constEnd(); it++) {  const Function& fn = it.value();
@@ -198,9 +127,6 @@ void Util::preparse(QSet<Type*> *usedTypes, QSet<const Class*> \
*superClasses, co  
         Method meth = 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 header it \
was defined in  globalFunctionMap[&parent->methods().last()] = &fn;
@@ -215,10 +141,6 @@ void Util::preparse(QSet<Type*> *usedTypes, QSet<const Class*> \
*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<QString, Enum>::iterator it = enums.begin(); it != enums.end(); it++) \
{


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic