|
48 | 48 | #include "generatorset.h" |
49 | 49 | #include "fileout.h" |
50 | 50 | #include "control.h" |
51 | | -#include "pp.h" |
52 | 51 | #include "simplecpp.h" |
53 | 52 |
|
54 | 53 | #include <QDir> |
@@ -212,60 +211,6 @@ namespace |
212 | 211 | return true; |
213 | 212 | } |
214 | 213 |
|
215 | | - |
216 | | - bool |
217 | | - preprocess2(const QString &sourceFile, const QString &targetFile, const QString &commandLineIncludes = QString()) |
218 | | - { |
219 | | - rpp::pp_environment env; |
220 | | - rpp::pp preprocess(env); |
221 | | - |
222 | | - rpp::pp_null_output_iterator null_out; |
223 | | - |
224 | | - const char *ppconfig = ":/trolltech/generator/parser/rpp/pp-qt-configuration"; |
225 | | - |
226 | | - QFile file(ppconfig); |
227 | | - if (!file.open(QFile::ReadOnly)) |
228 | | - { |
229 | | - fprintf(stderr, "Preprocessor configuration file not found '%s'\n", ppconfig); |
230 | | - return false; |
231 | | - } |
232 | | - |
233 | | - QByteArray ba = file.readAll(); |
234 | | - file.close(); |
235 | | - preprocess.operator()(ba.constData(), ba.constData() + ba.size(), null_out); |
236 | | - |
237 | | - foreach(QString |
238 | | - include, getIncludeDirectories(commandLineIncludes)) { |
239 | | - preprocess.push_include_path(QDir::toNativeSeparators(include).toStdString()); |
240 | | - } |
241 | | - |
242 | | - QString currentDir = QDir::current().absolutePath(); |
243 | | - QFileInfo sourceInfo(sourceFile); |
244 | | - QDir::setCurrent(sourceInfo.absolutePath()); |
245 | | - |
246 | | - std::string result; |
247 | | - result.reserve(20 * 1024); // 20K |
248 | | - |
249 | | - result += "# 1 \"builtins\"\n"; |
250 | | - result += "# 1 \""; |
251 | | - result += sourceFile.toStdString(); |
252 | | - result += "\"\n"; |
253 | | - |
254 | | - preprocess.file(sourceInfo.fileName().toStdString(), |
255 | | - rpp::pp_output_iterator<std::string>(result)); |
256 | | - |
257 | | - QDir::setCurrent(currentDir); |
258 | | - |
259 | | - QFile f(targetFile); |
260 | | - if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) |
261 | | - { |
262 | | - fprintf(stderr, "Failed to write preprocessed file: %s\n", qPrintable(targetFile)); |
263 | | - } |
264 | | - f.write(result.c_str(), result.length()); |
265 | | - |
266 | | - return true; |
267 | | - } |
268 | | - |
269 | 214 | unsigned int getQtVersion(const QString &commandLineIncludes) |
270 | 215 | { |
271 | 216 | QRegularExpression re("#define\\s+QTCORE_VERSION\\s+0x([0-9a-f]+)", QRegularExpression::CaseInsensitiveOption); |
|
0 commit comments