mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-11-22 16:44:48 +00:00
moveh:: line numbers for easier debugging
This commit is contained in:
15
makeh.cpp
15
makeh.cpp
@@ -30,12 +30,16 @@ int in_hdr;
|
|||||||
|
|
||||||
set<string> seen;
|
set<string> seen;
|
||||||
|
|
||||||
void gen(string s) {
|
int lineid;
|
||||||
if(seen.count(s)) return;
|
|
||||||
seen.insert(s);
|
void gen(string sf) {
|
||||||
which_file = s;
|
if(seen.count(sf)) return;
|
||||||
ifstream in(s);
|
seen.insert(sf);
|
||||||
|
which_file = sf; lineid = -1;
|
||||||
|
ifstream in(sf);
|
||||||
|
string s;
|
||||||
while(getline(in, s)) {
|
while(getline(in, s)) {
|
||||||
|
lineid++;
|
||||||
while(s != "" && s[0] == ' ') s = s.substr(1);
|
while(s != "" && s[0] == ' ') s = s.substr(1);
|
||||||
while(s.back() == 10 || s.back() == 13) s = s.substr(0, s.size() - 1);
|
while(s.back() == 10 || s.back() == 13) s = s.substr(0, s.size() - 1);
|
||||||
if(in_hdr) {
|
if(in_hdr) {
|
||||||
@@ -49,6 +53,7 @@ void gen(string s) {
|
|||||||
}
|
}
|
||||||
if(s == "#if HDR") {
|
if(s == "#if HDR") {
|
||||||
mark_file();
|
mark_file();
|
||||||
|
cout << "#line " << lineid << " \"" << sf << "\"\n";
|
||||||
in_hdr = true;
|
in_hdr = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user