From 83a7e0f5186acd1d88d33e397dbe26ef203eb9b9 Mon Sep 17 00:00:00 2001 From: Roberto Raggi <roberto.raggi@nokia.com> Date: Tue, 27 Oct 2009 11:31:26 +0100 Subject: [PATCH] Print the result of the preprocessor. --- tests/manual/preprocessor/main.cpp | 32 ++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/manual/preprocessor/main.cpp b/tests/manual/preprocessor/main.cpp index 64de2e56f54..2aaecb0027d 100644 --- a/tests/manual/preprocessor/main.cpp +++ b/tests/manual/preprocessor/main.cpp @@ -69,9 +69,15 @@ public: #endif } + virtual void passedMacroDefinitionCheck(unsigned, const Macro &) + { } + + virtual void failedMacroDefinitionCheck(unsigned, const QByteArray &) + { } + virtual void startExpandingMacro(unsigned, const Macro &, const QByteArray &, - const QVector<MacroArgumentReference> &) + bool, const QVector<MacroArgumentReference> &) { } virtual void stopExpandingMacro(unsigned, const Macro &) @@ -84,11 +90,33 @@ public: { } }; +int make_depend(QCoreApplication *app); + + int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); - QStringList todo = app.arguments(); + QStringList args = app.arguments(); + args.removeFirst(); + + foreach (const QString &fileName, args) { + QFile file(fileName); + if (file.open(QFile::ReadOnly)) { + QTextStream in(&file); + const QString source = in.readAll(); + + Environment env; + Preprocessor pp(/*client=*/ 0, &env); + const QByteArray preprocessedCode = pp(fileName, source); + std::cout << preprocessedCode.constData(); + } + } +} + +int make_depend(QCoreApplication *app) +{ + QStringList todo = app->arguments(); todo.removeFirst(); if (todo.isEmpty()) -- GitLab