44 |
|
#include <iostream> |
45 |
|
#include <set> |
46 |
|
#include <fstream> |
47 |
+ |
#include <sstream> |
48 |
|
#include "utils/StringTokenizer.hpp" |
49 |
|
#include "utils/Trim.hpp" |
50 |
+ |
#include "utils/OOPSEException.hpp" |
51 |
+ |
|
52 |
|
/** |
53 |
|
* @class SimplePreprocessor |
54 |
|
* @brief A simple preprocessor. |
69 |
|
private: |
70 |
|
bool doPreprocess(const std::string& filename, ostream& os, std::set<std::string>& defineSet, std::stack<bool>& ifStates) { |
71 |
|
std::ifstream input(filename.c_str()); |
72 |
< |
|
72 |
> |
if (!input.is_open()) { |
73 |
> |
std::stringstream ss; |
74 |
> |
ss << "Can not open " << filename << " for preprocessing\n"; |
75 |
> |
throw OOPSEException(ss.str()); |
76 |
> |
} |
77 |
|
int lineNo =1; |
78 |
|
os << "#line " << lineNo << " \"" << filename << "\"\n"; |
79 |
|
while(input.getline(buffer, bufferSize)) { |