tools/qdoc3/main.cpp
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
child 33 3e2da88830cd
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    42 /*
    42 /*
    43   main.cpp
    43   main.cpp
    44 */
    44 */
    45 
    45 
    46 #include <qglobal.h>
    46 #include <qglobal.h>
    47 #include <QtCore>
       
    48 #include <stdlib.h>
    47 #include <stdlib.h>
    49 #include "apigenerator.h"
    48 #include "apigenerator.h"
    50 #include "codemarker.h"
    49 #include "codemarker.h"
    51 #include "codeparser.h"
    50 #include "codeparser.h"
    52 #include "config.h"
    51 #include "config.h"
    69 #include "qscodeparser.h"
    68 #include "qscodeparser.h"
    70 #include "sgmlgenerator.h"
    69 #include "sgmlgenerator.h"
    71 #include "webxmlgenerator.h"
    70 #include "webxmlgenerator.h"
    72 #include "tokenizer.h"
    71 #include "tokenizer.h"
    73 #include "tree.h"
    72 #include "tree.h"
       
    73 #include <qdebug.h>
       
    74 
       
    75 #include "qtranslator.h"
       
    76 #ifndef QT_BOOTSTRAPPED
       
    77 #  include "qcoreapplication.h"
       
    78 #endif
    74 
    79 
    75 QT_BEGIN_NAMESPACE
    80 QT_BEGIN_NAMESPACE
    76 
    81 
    77 /*
    82 /*
    78   The default indent for code is 4.
    83   The default indent for code is 4.
   149   Processes the qdoc config file \a fileName. This is the
   154   Processes the qdoc config file \a fileName. This is the
   150   controller for all of qdoc.
   155   controller for all of qdoc.
   151  */
   156  */
   152 static void processQdocconfFile(const QString &fileName)
   157 static void processQdocconfFile(const QString &fileName)
   153 {
   158 {
       
   159 #ifndef QT_NO_TRANSLATION
   154     QList<QTranslator *> translators;
   160     QList<QTranslator *> translators;
       
   161 #endif
   155 
   162 
   156     /*
   163     /*
   157       The Config instance represents the configuration data for qdoc.
   164       The Config instance represents the configuration data for qdoc.
   158       All the other classes are initialized with the config. Here we
   165       All the other classes are initialized with the config. Here we
   159       initialize the configuration with some default values.
   166       initialize the configuration with some default values.
   205     CppToQsConverter::initialize(config);
   212     CppToQsConverter::initialize(config);
   206     CodeMarker::initialize(config);
   213     CodeMarker::initialize(config);
   207     CodeParser::initialize(config);
   214     CodeParser::initialize(config);
   208     Generator::initialize(config);
   215     Generator::initialize(config);
   209 
   216 
       
   217 #ifndef QT_NO_TRANSLATION
   210     /*
   218     /*
   211       Load the language translators, if the configuration specifies any.
   219       Load the language translators, if the configuration specifies any.
   212      */
   220      */
   213     QStringList fileNames = config.getStringList(CONFIG_TRANSLATORS);
   221     QStringList fileNames = config.getStringList(CONFIG_TRANSLATORS);
   214     QStringList::Iterator fn = fileNames.begin();
   222     QStringList::Iterator fn = fileNames.begin();
   219 					 .arg(*fn));
   227 					 .arg(*fn));
   220 	QCoreApplication::instance()->installTranslator(translator);
   228 	QCoreApplication::instance()->installTranslator(translator);
   221 	translators.append(translator);
   229 	translators.append(translator);
   222 	++fn;
   230 	++fn;
   223     }
   231     }
       
   232 #endif
   224 
   233 
   225     //QSet<QString> outputLanguages = config.getStringSet(CONFIG_OUTPUTLANGUAGES);
   234     //QSet<QString> outputLanguages = config.getStringSet(CONFIG_OUTPUTLANGUAGES);
   226 
   235 
   227     /*
   236     /*
   228       Get the source language (Cpp) from the configuration
   237       Get the source language (Cpp) from the configuration
   335 
   344 
   336     /*
   345     /*
   337       Generate the XML tag file, if it was requested.
   346       Generate the XML tag file, if it was requested.
   338      */
   347      */
   339     QString tagFile = config.getString(CONFIG_TAGFILE);
   348     QString tagFile = config.getString(CONFIG_TAGFILE);
   340     if (!tagFile.isEmpty())
   349     if (!tagFile.isEmpty()) {
   341         tree->generateTagFile(tagFile);
   350         tree->generateTagFile(tagFile);
       
   351     }
   342 
   352 
   343     tree->setVersion("");
   353     tree->setVersion("");
   344     Generator::terminate();
   354     Generator::terminate();
   345     CodeParser::terminate();
   355     CodeParser::terminate();
   346     CodeMarker::terminate();
   356     CodeMarker::terminate();
   348     Doc::terminate();
   358     Doc::terminate();
   349     Tokenizer::terminate();
   359     Tokenizer::terminate();
   350     Location::terminate();
   360     Location::terminate();
   351     QDir::setCurrent(prevCurrentDir);
   361     QDir::setCurrent(prevCurrentDir);
   352 
   362 
   353     foreach (QTranslator *translator, translators)
   363 #ifndef QT_NO_TRANSLATION
   354         delete translator;
   364     qDeleteAll(translators);
       
   365 #endif
       
   366 #ifdef DEBUG_SHUTDOWN_CRASH    
       
   367     qDebug() << "main(): Delete tree";
       
   368 #endif    
   355     delete tree;
   369     delete tree;
       
   370 #ifdef DEBUG_SHUTDOWN_CRASH    
       
   371     qDebug() << "main(): Tree deleted";
       
   372 #endif
   356 }
   373 }
   357 
   374 
   358 QT_END_NAMESPACE
   375 QT_END_NAMESPACE
   359 
   376 
   360 int main(int argc, char **argv)
   377 int main(int argc, char **argv)
   361 {
   378 {
   362     QT_USE_NAMESPACE
   379     QT_USE_NAMESPACE
   363 
   380 
       
   381 #ifndef QT_BOOTSTRAPPED
   364     QCoreApplication app(argc, argv);
   382     QCoreApplication app(argc, argv);
       
   383 #endif
   365     QString cf = "qsauncompress \1 \2";
   384     QString cf = "qsauncompress \1 \2";
   366     PolyArchiveExtractor qsaExtractor(QStringList() << "qsa",cf);
   385     PolyArchiveExtractor qsaExtractor(QStringList() << "qsa",cf);
   367     cf = "tar -C \2 -xf \1";
   386     cf = "tar -C \2 -xf \1";
   368     PolyArchiveExtractor tarExtractor(QStringList() << "tar",cf);
   387     PolyArchiveExtractor tarExtractor(QStringList() << "tar",cf);
   369     cf = "tar -C \2 -Zxf \1";
   388     cf = "tar -C \2 -Zxf \1";