Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if ((macro = target_.defines_->find(symbol)) != target_.defines_->end())
- {
- preproc_define const &val = macro->second;
- size_t nb_arg = strings_.size() - token.stack_pos - 1;
- if (nb_arg != val.arguments.size())
- {
- std::ostringstream error;
- error << "preprocessor symbol '" << symbol << "' expects "
- << val.arguments.size() << " arguments, but has "
- << nb_arg << " arguments";
- target_.error(error.str(), linenum_);
- }
- std::istringstream *buffer = new std::istringstream(val.value);
- std::map<std::string, std::string> *defines =
- new std::map<std::string, std::string>;
- for (size_t i = 0; i < nb_arg; ++i) {
- (*defines)[val.arguments[i]] = strings_[token.stack_pos + i + 1];
- }
- pop_token();
- std::string const &dir = directory_name(val.location.substr(0, val.location.find(' ')));
- if (!slowpath_) {
- DBG_CF << "substituting macro " << symbol << '\n';
- new preprocessor_data(target_, buffer, val.location, "",
- val.linenum, dir, val.textdomain, defines);
- } else {
- DBG_CF << "substituting (slow) macro " << symbol << '\n';
- std::ostringstream res;
- preprocessor_streambuf *buf =
- new preprocessor_streambuf(target_);
- { std::istream in(buf);
- new preprocessor_data(*buf, buffer, val.location, "",
- val.linenum, dir, val.textdomain, defines);
- res << in.rdbuf(); }
- delete buf;
- put(res.str());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment