##// END OF EJS Templates
improved code generation for virtual functions to support overriding getter slots that are named as properties...
improved code generation for virtual functions to support overriding getter slots that are named as properties git-svn-id: svn://svn.code.sf.net/p/pythonqt/code/trunk@240 ea8d5007-eb21-0410-b261-ccb3ea6e24a9

File last commit:

r162:1182b71738ca
r199:1f55453df6ee
Show More
main.cpp
188 lines | 6.1 KiB | text/x-c | CppLexer
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 /****************************************************************************
**
florianlink
updated generator to LGPLed version from gitorious...
r87 ** Copyright (C) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 **
florianlink
updated generator to LGPLed version from gitorious...
r87 ** This file is part of the Qt Script Generator project on Qt Labs.
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 **
florianlink
updated generator to LGPLed version from gitorious...
r87 ** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 **
florianlink
updated generator to LGPLed version from gitorious...
r87 ** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 **
florianlink
updated generator to LGPLed version from gitorious...
r87 ** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 **
****************************************************************************/
#include "main.h"
#include "asttoxml.h"
#include "reporthandler.h"
#include "typesystem.h"
#include "generatorset.h"
#include "fileout.h"
#include <QDir>
void displayHelp(GeneratorSet *generatorSet);
#include <QDebug>
int main(int argc, char *argv[])
florianlink
merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched...
r162 {
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 GeneratorSet *gs = GeneratorSet::getInstance();
QString default_file = ":/trolltech/generator/qtscript_masterinclude.h";
QString default_system = ":/trolltech/generator/build_all.txt";
QString fileName;
QString typesystemFileName;
QString pp_file = ".preprocessed.tmp";
QStringList rebuild_classes;
florianlink
merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched...
r162
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 QMap<QString, QString> args;
int argNum = 0;
for (int i=1; i<argc; ++i) {
QString arg(argv[i]);
arg = arg.trimmed();
if( arg.startsWith("--") ) {
int split = arg.indexOf("=");
if( split > 0 )
args[arg.mid(2).left(split-2)] = arg.mid(split + 1).trimmed();
else
args[arg.mid(2)] = QString();
} else if( arg.startsWith("-")) {
args[arg.mid(1)] = QString();
} else {
argNum++;
args[QString("arg-%1").arg(argNum)] = arg;
}
}
florianlink
merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched...
r162
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 if (args.contains("no-suppress-warnings")) {
TypeDatabase *db = TypeDatabase::instance();
db->setSuppressWarnings(false);
}
florianlink
merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched...
r162
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 if (args.contains("debug-level")) {
QString level = args.value("debug-level");
if (level == "sparse")
ReportHandler::setDebugLevel(ReportHandler::SparseDebug);
else if (level == "medium")
ReportHandler::setDebugLevel(ReportHandler::MediumDebug);
else if (level == "full")
ReportHandler::setDebugLevel(ReportHandler::FullDebug);
florianlink
merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched...
r162 }
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10
if (args.contains("dummy")) {
FileOut::dummy = true;
}
if (args.contains("diff")) {
FileOut::diff = true;
}
if (args.contains("license"))
FileOut::license = true;
if (args.contains("rebuild-only")) {
QStringList classes = args.value("rebuild-only").split(",", QString::SkipEmptyParts);
TypeDatabase::instance()->setRebuildClasses(classes);
}
fileName = args.value("arg-1");
typesystemFileName = args.value("arg-2");
if (args.contains("arg-3"))
displayHelp(gs);
if (fileName.isEmpty())
fileName = default_file;
if (typesystemFileName.isEmpty())
typesystemFileName = default_system;
if (fileName.isEmpty() || typesystemFileName.isEmpty() )
displayHelp(gs);
if (!gs->readParameters(args))
displayHelp(gs);
printf("Please wait while source files are being generated...\n");
florianlink
merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched...
r162 printf("Parsing typesystem file [%s]\n", qPrintable(typesystemFileName));
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 if (!TypeDatabase::instance()->parseFile(typesystemFileName))
qFatal("Cannot parse file: '%s'", qPrintable(typesystemFileName));
florianlink
merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched...
r162 printf("PreProcessing - Generate [%s] using [%s] and include-paths [%s]\n",
qPrintable(pp_file), qPrintable(fileName), qPrintable(args.value("include-paths")));
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 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")) {
florianlink
merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched...
r162 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;
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 }
florianlink
merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched...
r162 printf("Building model using [%s]\n", qPrintable(pp_file));
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 gs->buildModel(pp_file);
if (args.contains("dump-object-tree")) {
gs->dumpObjectTree();
return 0;
}
printf("%s\n", qPrintable(gs->generate()));
printf("Done, %d warnings (%d known issues)\n", ReportHandler::warningCount(),
ReportHandler::suppressedCount());
}
void displayHelp(GeneratorSet* generatorSet) {
#if defined(Q_OS_WIN32)
char path_splitter = ';';
#else
char path_splitter = ':';
#endif
printf("Usage:\n generator [options] header-file typesystem-file\n\n");
printf("Available options:\n\n");
printf("General:\n");
printf(" --debug-level=[sparse|medium|full] \n"
" --dump-object-tree \n"
" --help, -h or -? \n"
" --no-suppress-warnings \n"
" --output-directory=[dir] \n"
" --include-paths=<path>[%c<path>%c...] \n"
" --print-stdout \n",
path_splitter, path_splitter);
florianlink
merged contributions from https://github.com/commontk/PythonQt/compare/svn-mirror...patched...
r162
florianlink
syncing with my current work, updating to 1.2, see changelog...
r10 printf("%s", qPrintable( generatorSet->usage()));
exit(0);
}