1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include "main.ih"
//code
void results()
{
g_out.seekg(0);
int value;
string line;
string errorDisplay;
while (g_out >> value >> line) // process g_out's content
{
g_out.ignore(100, '\n');
if (value == 0) // no error: show the source file
{
cerr << line << '\n';
continue;
}
// at compilation errors:
if (not errorDisplay.empty()) // after the 1st error: skip
{
do
{
getline(g_out, line);
}
while (line != g_marker);
continue;
}
// first compilation error:
errorDisplay = line + '\n'; // keep the the name of the source
while (true) // and its error messages
{
getline(g_out, line);
if (line == g_marker)
break;
errorDisplay += line + '\n';
}
}
cerr << errorDisplay; // eventually insert the error-info
} // (if any)
//=
|