comparison generator/dgenerator.cpp @ 386:7dddafad5a20

shared stor fix
author Max Samukha <maxter@spambox.com>
date Mon, 19 Jul 2010 13:29:57 +0300
parents d2f48c4cb3e3
children 1049b01aebd2
comparison
equal deleted inserted replaced
385:e700fa4916e4 386:7dddafad5a20
2071 if ((sc != d_class->name()) && !sc.isEmpty()) { 2071 if ((sc != d_class->name()) && !sc.isEmpty()) {
2072 s << " : " << sc; 2072 s << " : " << sc;
2073 implements = true; 2073 implements = true;
2074 } 2074 }
2075 */ 2075 */
2076 // only QObjects are handled polymorphically for now
2076 if (d_class->isQObject()) 2077 if (d_class->isQObject())
2077 s << " : QtdObject"; 2078 s << " : PolymorphicObject";
2078 else 2079 else
2079 s << " : QtdObject"; 2080 s << " : QtdObject";
2080 implements = true; 2081 implements = true;
2081 } 2082 }
2082 }/* qtd else if (d_class->isInterface()) { 2083 }/* qtd else if (d_class->isInterface()) {
2327 s << INDENT << "//assert (!(initFlags & QtdObjectInitFlags.onStack));" << endl 2328 s << INDENT << "//assert (!(initFlags & QtdObjectInitFlags.onStack));" << endl
2328 << INDENT << "qtdPin();" << endl 2329 << INDENT << "qtdPin();" << endl
2329 << INDENT << "_flags.isQObject = true;" << endl; 2330 << INDENT << "_flags.isQObject = true;" << endl;
2330 } 2331 }
2331 2332
2332 // only QObjects are handled polymorphically for now
2333 if (d_class->name() == "QObject" /* d_class->polymorphicBase() == d_class */)
2334 s << INDENT << "_flags.polymorphic = true;" << endl;
2335
2336 s << INDENT << "super(nativeId, initFlags);" << endl; 2333 s << INDENT << "super(nativeId, initFlags);" << endl;
2337 2334
2338 // pointers to native interface objects for classes that implement interfaces 2335 // pointers to native interface objects for classes that implement interfaces
2339 // initializing 2336 // initializing
2340 interfaces = d_class->interfaces(); 2337 interfaces = d_class->interfaces();
2567 if (global.cppShared && d_class->generateShellClass()) { 2564 if (global.cppShared && d_class->generateShellClass()) {
2568 2565
2569 AbstractMetaFunction::Options opts(AbstractMetaFunction::DeclaringClass | AbstractMetaFunction::NoExternNamespace); 2566 AbstractMetaFunction::Options opts(AbstractMetaFunction::DeclaringClass | AbstractMetaFunction::NoExternNamespace);
2570 2567
2571 // virtual functions 2568 // virtual functions
2572 s << INDENT << "void*[" << virtualFunctions.size() << "] virt_arr;" << endl; 2569 int virtuals_index = 0;
2573 for (int pos = 0; pos<virtualFunctions.size(); ++pos) { 2570 QString virtuals_init;
2574 const AbstractMetaFunction *function = virtualFunctions.at(pos); 2571
2572 foreach (const AbstractMetaFunction *function, virtualFunctions) {
2575 if (!notWrappedYet(function) && d_class == function->declaringClass()) { 2573 if (!notWrappedYet(function) && d_class == function->declaringClass()) {
2576 QString mName = function->marshalledName(opts); 2574 QString mName = function->marshalledName(opts);
2577 s << INDENT << "virt_arr[" << pos << "] = &qtd_export_" << mName << "_dispatch;" <<endl; 2575 virtuals_init += QString(" virt_arr[%1] = &qtd_export_%2_dispatch;\n").arg(virtuals_index).arg(mName);
2576 virtuals_index++;
2578 } 2577 }
2579 } 2578 }
2580 2579
2581 if (virtualFunctions.size() == 0) 2580 if (virtuals_index == 0)
2582 initArgs = "null"; 2581 initArgs = "null";
2583 else 2582 else {
2583 s << " void*[" << virtuals_index << "] virt_arr;" << endl;
2584 s << virtuals_init;
2584 initArgs = "virt_arr.ptr"; 2585 initArgs = "virt_arr.ptr";
2586 }
2585 2587
2586 if (d_class->name() == "QObject") { 2588 if (d_class->name() == "QObject") {
2587 // qt_metacall, metaObject 2589 // qt_metacall, metaObject
2588 s << endl << INDENT << "void*[2] sign_arr;" << endl; 2590 s << endl << INDENT << "void*[2] sign_arr;" << endl;
2589 s << INDENT << "sign_arr[0] = &qtd_export_QObject_qt_metacall_dispatch;" << endl; 2591 s << INDENT << "sign_arr[0] = &qtd_export_QObject_qt_metacall_dispatch;" << endl;