##// END OF EJS Templates
florianlink -
r162:1182b71738ca
parent child
Show More
@@ -52,7 +52,7 void displayHelp(GeneratorSet *generatorSet);
52
52
53 #include <QDebug>
53 #include <QDebug>
54 int main(int argc, char *argv[])
54 int main(int argc, char *argv[])
55 {
55 {
56 GeneratorSet *gs = GeneratorSet::getInstance();
56 GeneratorSet *gs = GeneratorSet::getInstance();
57
57
58 QString default_file = ":/trolltech/generator/qtscript_masterinclude.h";
58 QString default_file = ":/trolltech/generator/qtscript_masterinclude.h";
@@ -62,7 +62,7 int main(int argc, char *argv[])
62 QString typesystemFileName;
62 QString typesystemFileName;
63 QString pp_file = ".preprocessed.tmp";
63 QString pp_file = ".preprocessed.tmp";
64 QStringList rebuild_classes;
64 QStringList rebuild_classes;
65
65
66 QMap<QString, QString> args;
66 QMap<QString, QString> args;
67
67
68 int argNum = 0;
68 int argNum = 0;
@@ -82,12 +82,12 int main(int argc, char *argv[])
82 args[QString("arg-%1").arg(argNum)] = arg;
82 args[QString("arg-%1").arg(argNum)] = arg;
83 }
83 }
84 }
84 }
85
85
86 if (args.contains("no-suppress-warnings")) {
86 if (args.contains("no-suppress-warnings")) {
87 TypeDatabase *db = TypeDatabase::instance();
87 TypeDatabase *db = TypeDatabase::instance();
88 db->setSuppressWarnings(false);
88 db->setSuppressWarnings(false);
89 }
89 }
90
90
91 if (args.contains("debug-level")) {
91 if (args.contains("debug-level")) {
92 QString level = args.value("debug-level");
92 QString level = args.value("debug-level");
93 if (level == "sparse")
93 if (level == "sparse")
@@ -96,7 +96,7 int main(int argc, char *argv[])
96 ReportHandler::setDebugLevel(ReportHandler::MediumDebug);
96 ReportHandler::setDebugLevel(ReportHandler::MediumDebug);
97 else if (level == "full")
97 else if (level == "full")
98 ReportHandler::setDebugLevel(ReportHandler::FullDebug);
98 ReportHandler::setDebugLevel(ReportHandler::FullDebug);
99 }
99 }
100
100
101 if (args.contains("dummy")) {
101 if (args.contains("dummy")) {
102 FileOut::dummy = true;
102 FileOut::dummy = true;
@@ -134,19 +134,25 int main(int argc, char *argv[])
134
134
135 printf("Please wait while source files are being generated...\n");
135 printf("Please wait while source files are being generated...\n");
136
136
137 printf("Parsing typesystem file [%s]\n", qPrintable(typesystemFileName));
137 if (!TypeDatabase::instance()->parseFile(typesystemFileName))
138 if (!TypeDatabase::instance()->parseFile(typesystemFileName))
138 qFatal("Cannot parse file: '%s'", qPrintable(typesystemFileName));
139 qFatal("Cannot parse file: '%s'", qPrintable(typesystemFileName));
139
140
141 printf("PreProcessing - Generate [%s] using [%s] and include-paths [%s]\n",
142 qPrintable(pp_file), qPrintable(fileName), qPrintable(args.value("include-paths")));
140 if (!Preprocess::preprocess(fileName, pp_file, args.value("include-paths"))) {
143 if (!Preprocess::preprocess(fileName, pp_file, args.value("include-paths"))) {
141 fprintf(stderr, "Preprocessor failed on file: '%s'\n", qPrintable(fileName));
144 fprintf(stderr, "Preprocessor failed on file: '%s'\n", qPrintable(fileName));
142 return 1;
145 return 1;
143 }
146 }
144
147
145 if (args.contains("ast-to-xml")) {
148 if (args.contains("ast-to-xml")) {
146 astToXML(pp_file);
149 printf("Running ast-to-xml on file [%s] using pp_file [%s] and include-paths [%s]\n",
147 return 0;
150 qPrintable(fileName), qPrintable(pp_file), qPrintable(args.value("include-paths")));
151 astToXML(pp_file);
152 return 0;
148 }
153 }
149
154
155 printf("Building model using [%s]\n", qPrintable(pp_file));
150 gs->buildModel(pp_file);
156 gs->buildModel(pp_file);
151 if (args.contains("dump-object-tree")) {
157 if (args.contains("dump-object-tree")) {
152 gs->dumpObjectTree();
158 gs->dumpObjectTree();
@@ -176,7 +182,7 void displayHelp(GeneratorSet* generatorSet) {
176 " --include-paths=<path>[%c<path>%c...] \n"
182 " --include-paths=<path>[%c<path>%c...] \n"
177 " --print-stdout \n",
183 " --print-stdout \n",
178 path_splitter, path_splitter);
184 path_splitter, path_splitter);
179
185
180 printf("%s", qPrintable( generatorSet->usage()));
186 printf("%s", qPrintable( generatorSet->usage()));
181 exit(0);
187 exit(0);
182 }
188 }
@@ -57,7 +57,7 void ReportHandler::warning(const QString &text)
57 if (db && db->isSuppressedWarning(warningText)) {
57 if (db && db->isSuppressedWarning(warningText)) {
58 ++m_suppressed_count;
58 ++m_suppressed_count;
59 } else if (!m_reported_warnings.contains(warningText)) {
59 } else if (!m_reported_warnings.contains(warningText)) {
60 qDebug(qPrintable(warningText));
60 qDebug("%s", qPrintable(warningText));
61 ++m_warning_count;
61 ++m_warning_count;
62
62
63 m_reported_warnings.insert(warningText);
63 m_reported_warnings.insert(warningText);
@@ -171,7 +171,9 void SetupGenerator::generate()
171
171
172
172
173 {
173 {
174 FileOut initFile(m_out_dir + "/generated_cpp/" + packName + "/" + packKey + "_init.cpp");
174 QString fileName(packName + "/" + packKey + "_init.cpp");
175 FileOut initFile(m_out_dir + "/generated_cpp/" + fileName);
176 ReportHandler::debugSparse(QString("generating: %1").arg(fileName));
175 QTextStream &s = initFile.stream;
177 QTextStream &s = initFile.stream;
176
178
177 s << "#include <PythonQt.h>" << endl;
179 s << "#include <PythonQt.h>" << endl;
@@ -264,7 +266,7 QStringList SetupGenerator::writePolymorphicHandler(QTextStream &s, const QStrin
264 handlers.append(handler);
266 handlers.append(handler);
265
267
266 s << "static void* polymorphichandler_" << handler
268 s << "static void* polymorphichandler_" << handler
267 << "(const void *ptr, char **class_name)" << endl
269 << "(const void *ptr, const char **class_name)" << endl
268 << "{" << endl
270 << "{" << endl
269 << " Q_ASSERT(ptr != 0);" << endl
271 << " Q_ASSERT(ptr != 0);" << endl
270 << " " << cls->qualifiedCppName() << " *object = ("
272 << " " << cls->qualifiedCppName() << " *object = ("
General Comments 0
You need to be logged in to leave comments. Login now