13 bool has_prefix(
const std::string &s,
const std::string &prefix)
15 return std::string(s, 0, prefix.size())==prefix;
25 std::string
function = std::string(line, 13, std::string::npos);
26 std::size_t
pos =
function.find(
' ');
27 if(
pos != std::string::npos)
28 function = std::string(
function, 0,
pos);
30 std::cout <<
"{ \"" <<
function <<
"\",\n";
31 std::cout <<
" \"#line 1 \\\"<builtin-library-" <<
function
38 for(
unsigned i = 0; i < line.size(); i++)
40 const char ch = line[i];
45 else if(ch ==
'\r' || ch ==
'\n')
52 std::cout <<
"\\n\"\n";
56 int main(
int argc,
char *argv[])
63 for(
int i = 1; i < argc; ++i)
65 std::ifstream input_file(argv[i]);
69 std::cerr <<
"Failed to open " << argv[i] <<
'\n';
73 while(getline(input_file, line))
int main(int argc, char *argv[])
static void convert_line(const std::string &line, bool first)
bool has_prefix(const std::string &s, const std::string &prefix)