Quote:
1. the __LINE__ auto define is starting from 0 (and not 1 as a common text editor would do), so all lines are less 1 than the real line value, i fixed by adding 1 to the setLineMacro function (easy to fix and not so important bug).
I've never used the __LINE__ macro myself, so, eh. Make sure you don't mess with the running line count, or the Line Number Translator won't work right. I made this change in preprocess.cpp -
static void setLineMacro(DefineTable& define_table, unsigned int line){ DefineEntry def; Lexem l; l.type = NUMBER; std::stringstream sstr; sstr << (line+1); //<-- This line changed. sstr >> l.value; def.lexems.push_back(l); define_table["__LINE__"] = def;}
If you're using boost, you should change that to use lexical_cast instead of stringstream.
Quote:
2. now when debugging this, i start the debugger from the first file and if i leave the last character of the included file not equal to a newline character (in the example is ending with "}", but could be even a space), i get a wrong file and line resolve: mainly "return i" of secondCall is resolved as first script file, line 2 (and not second file line 13). then if i add a newline to the end of the second file, all is working gr8. dunnow what could be this, i'm trying to figure out what's wrong with the inclusion of a file without a ending newline. if i found something i'll tell ya... and you the same of course ;) eheh
It used to crash if you left off the newline. Since my IDE always adds the newline, and I edit my scripts in the IDE, it went a long time before I caught it. Theres a slightly newer version of the preprocessor inside my Wrapper Library; you should try that one and see if you have the same problems.
I'm going to look at it; I think I know what's happening. You should be able to just stick an extra newline onto the end of every file as it's loaded. Of course, it will think every file is one line too long - but that's fine, because a blank line can't have errors anyway.
Add the following between lines 509 and 510 of preprocess.cpp
data.push_back('\n');
This essentially forces every file to end with a newline token. When it didn't, the last line of the included file became to same line as the #include was on in the first file, and every line after that was off by one.
:)