Allow commandline defines with string values
parent
2fcdf21f6e
commit
3023aa2c13
|
@ -21,6 +21,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
#include "MacroDriver.hh"
|
#include "MacroDriver.hh"
|
||||||
|
|
||||||
|
@ -55,7 +56,15 @@ MacroDriver::parse(const string &f, ostream &out, bool debug, bool no_line_macro
|
||||||
stringstream file_with_endl;
|
stringstream file_with_endl;
|
||||||
for (map<string,string>::iterator it=defines.begin();
|
for (map<string,string>::iterator it=defines.begin();
|
||||||
it!=defines.end(); it++)
|
it!=defines.end(); it++)
|
||||||
file_with_endl << "@#define " << it->first << " = " << it->second << endl;
|
try
|
||||||
|
{
|
||||||
|
boost::lexical_cast<int>(it->second);
|
||||||
|
file_with_endl << "@#define " << it->first << " = " << it->second << endl;
|
||||||
|
}
|
||||||
|
catch(boost::bad_lexical_cast &)
|
||||||
|
{
|
||||||
|
file_with_endl << "@#define " << it->first << " = \"" << it->second << "\"" << endl;
|
||||||
|
}
|
||||||
file_with_endl << in.rdbuf() << endl;
|
file_with_endl << in.rdbuf() << endl;
|
||||||
|
|
||||||
lexer = new MacroFlex(&file_with_endl, &out, no_line_macro);
|
lexer = new MacroFlex(&file_with_endl, &out, no_line_macro);
|
||||||
|
|
Loading…
Reference in New Issue