From 1182b71738cae59d0528accc874a4a43a8a77dd8 2011-11-14 10:13:02 From: florianlink Date: 2011-11-14 10:13:02 Subject: [PATCH] merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched changed polymorphichandler char** to const char** git-svn-id: svn://svn.code.sf.net/p/pythonqt/code/trunk@201 ea8d5007-eb21-0410-b261-ccb3ea6e24a9 --- diff --git a/generator/main.cpp b/generator/main.cpp index 9af0ae5..9961665 100644 --- a/generator/main.cpp +++ b/generator/main.cpp @@ -52,7 +52,7 @@ void displayHelp(GeneratorSet *generatorSet); #include int main(int argc, char *argv[]) -{ +{ GeneratorSet *gs = GeneratorSet::getInstance(); QString default_file = ":/trolltech/generator/qtscript_masterinclude.h"; @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) QString typesystemFileName; QString pp_file = ".preprocessed.tmp"; QStringList rebuild_classes; - + QMap args; int argNum = 0; @@ -82,12 +82,12 @@ int main(int argc, char *argv[]) args[QString("arg-%1").arg(argNum)] = arg; } } - + if (args.contains("no-suppress-warnings")) { TypeDatabase *db = TypeDatabase::instance(); db->setSuppressWarnings(false); } - + if (args.contains("debug-level")) { QString level = args.value("debug-level"); if (level == "sparse") @@ -96,7 +96,7 @@ int main(int argc, char *argv[]) ReportHandler::setDebugLevel(ReportHandler::MediumDebug); else if (level == "full") ReportHandler::setDebugLevel(ReportHandler::FullDebug); - } + } if (args.contains("dummy")) { FileOut::dummy = true; @@ -134,19 +134,25 @@ int main(int argc, char *argv[]) printf("Please wait while source files are being generated...\n"); + printf("Parsing typesystem file [%s]\n", qPrintable(typesystemFileName)); if (!TypeDatabase::instance()->parseFile(typesystemFileName)) qFatal("Cannot parse file: '%s'", qPrintable(typesystemFileName)); + printf("PreProcessing - Generate [%s] using [%s] and include-paths [%s]\n", + qPrintable(pp_file), qPrintable(fileName), qPrintable(args.value("include-paths"))); if (!Preprocess::preprocess(fileName, pp_file, args.value("include-paths"))) { fprintf(stderr, "Preprocessor failed on file: '%s'\n", qPrintable(fileName)); return 1; } if (args.contains("ast-to-xml")) { - astToXML(pp_file); - return 0; + printf("Running ast-to-xml on file [%s] using pp_file [%s] and include-paths [%s]\n", + qPrintable(fileName), qPrintable(pp_file), qPrintable(args.value("include-paths"))); + astToXML(pp_file); + return 0; } + printf("Building model using [%s]\n", qPrintable(pp_file)); gs->buildModel(pp_file); if (args.contains("dump-object-tree")) { gs->dumpObjectTree(); @@ -176,7 +182,7 @@ void displayHelp(GeneratorSet* generatorSet) { " --include-paths=[%c%c...] \n" " --print-stdout \n", path_splitter, path_splitter); - + printf("%s", qPrintable( generatorSet->usage())); exit(0); } diff --git a/generator/reporthandler.cpp b/generator/reporthandler.cpp index 7128ec2..8dc368a 100644 --- a/generator/reporthandler.cpp +++ b/generator/reporthandler.cpp @@ -57,7 +57,7 @@ void ReportHandler::warning(const QString &text) if (db && db->isSuppressedWarning(warningText)) { ++m_suppressed_count; } else if (!m_reported_warnings.contains(warningText)) { - qDebug(qPrintable(warningText)); + qDebug("%s", qPrintable(warningText)); ++m_warning_count; m_reported_warnings.insert(warningText); diff --git a/generator/setupgenerator.cpp b/generator/setupgenerator.cpp index 18d018a..c06fda3 100644 --- a/generator/setupgenerator.cpp +++ b/generator/setupgenerator.cpp @@ -171,7 +171,9 @@ void SetupGenerator::generate() { - FileOut initFile(m_out_dir + "/generated_cpp/" + packName + "/" + packKey + "_init.cpp"); + QString fileName(packName + "/" + packKey + "_init.cpp"); + FileOut initFile(m_out_dir + "/generated_cpp/" + fileName); + ReportHandler::debugSparse(QString("generating: %1").arg(fileName)); QTextStream &s = initFile.stream; s << "#include " << endl; @@ -264,7 +266,7 @@ QStringList SetupGenerator::writePolymorphicHandler(QTextStream &s, const QStrin handlers.append(handler); s << "static void* polymorphichandler_" << handler - << "(const void *ptr, char **class_name)" << endl + << "(const void *ptr, const char **class_name)" << endl << "{" << endl << " Q_ASSERT(ptr != 0);" << endl << " " << cls->qualifiedCppName() << " *object = ("