From 6eecee0c43e73da2d52929155c3ada9b32081dce Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Fri, 4 Sep 2009 16:22:16 -0700 Subject: bug 3737: - Remove Python workaround for 3.3.1 - Make Slice::Preprocessor a dynamically allocated class --- cpp/src/Slice/Preprocessor.cpp | 48 ++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 21 deletions(-) (limited to 'cpp/src/Slice/Preprocessor.cpp') diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index b5c8e7c19c4..8759bee15be 100644 --- a/cpp/src/Slice/Preprocessor.cpp +++ b/cpp/src/Slice/Preprocessor.cpp @@ -36,14 +36,20 @@ namespace Slice enum Outdest { Out=0, Err=1, Dbg=2, Num_Outdest=3 -}; - }; +} + extern "C" int mcpp_lib_main(int argc, char** argv); extern "C" void mcpp_use_mem_buffers(int tf); extern "C" char* mcpp_get_mem_buffer(Outdest od); +Slice::PreprocessorPtr +Slice::Preprocessor::create(const string& path, const string& fileName, const vector& args) +{ + return new Preprocessor(path, fileName, args); +} + Slice::Preprocessor::Preprocessor(const string& path, const string& fileName, const vector& args) : _path(path), _fileName(fullPath(fileName)), @@ -119,12 +125,12 @@ Slice::Preprocessor::normalizeIncludePath(const string& path) if(result == "/" || (result.size() == 3 && isalpha(static_cast(result[0])) && result[1] == ':' && result[2] == '/')) { - return result; + return result; } - + if(result.size() > 1 && result[result.size() - 1] == '/') { - result.erase(result.size() - 1); + result.erase(result.size() - 1); } return result; @@ -175,13 +181,13 @@ Slice::Preprocessor::preprocess(bool keepComments) { emitRaw(i->c_str()); - // - // MCPP FIX: mcpp does not always return non-zero exit status when there is an error. - // - if(i->find("error:") != string::npos) - { - status = 1; - } + // + // MCPP FIX: mcpp does not always return non-zero exit status when there is an error. + // + if(i->find("error:") != string::npos) + { + status = 1; + } } } @@ -206,7 +212,7 @@ Slice::Preprocessor::preprocess(bool keepComments) #else _cppHandle = tmpfile(); #endif - + // // If that fails try to open file in current directory. // @@ -273,7 +279,7 @@ Slice::Preprocessor::printMakefileDependencies(Language lang, const vector