-// I did not leave this inlined because DEC cxx does not like
-// variables declarations in inlined code (JMarc)
-TeXErrors::~TeXErrors()
-{
- Error *tmp;
- while (errors) {
- tmp = errors->next_error;
- delete errors;
- errors = tmp;
- }
-}
-
-
-void TeXErrors::scanError(LyXLex &lex)
-{
- string token = lex.GetString();
- // Sometimes the error string goes over more than one
- // line, and we need to get them all.
- string errstr;
- string tmp = frontStrip(readLine(lex.getFile()));
- if (tmp == "\n" || tmp.empty()) {
- tmp = frontStrip(readLine(lex.getFile()));
- if (contains(tmp, "See the LaTeX manual")) {
- do {
- tmp = readLine(lex.getFile());
- } while (!tmp.empty() && !contains(tmp, "..."));
- }
- tmp = frontStrip(readLine(lex.getFile()));
- }
-
- while ((tmp != "\n" || !contains(errstr, "l."))
- && !prefixIs(tmp, "! ")
- && !contains(tmp, "(job aborted")
- && !tmp.empty()) {
- errstr += tmp;
- tmp = frontStrip(readLine(lex.getFile()));
- }
- lyxerr.debug() << "tmp: " << errstr << endl;
- int line = 0;
- // unfortunately the error line is not always given
- // by "l.###" in the beginning of the error string
- // therefore we must search for "l.###" in the error
- // msg.
- if (contains(errstr, "l.")) {
- // We make a const copy to make [] fast. (Asger)
- string const es(errstr);
- for (string::size_type i = 2; i < es.length(); ++i) {
- if (es[i-2] == 'l' && es[i-1] == '.' &&
- (es[i] >= '0' && es[i]<= '9')) {
- line = atoi(es.c_str() + i);
- break;
- }
- }
- }
- insertError(line, token, errstr);
-
- if (prefixIs(tmp, "! ")) {
- scanError(lex);
- }
-}
-
-
-bool TeXErrors::getFirstError(int *line, string *text)
-{
- next_error = errors;
- if (next_error) {
- *line = next_error->error_in_line;
- *text = next_error->error_desc + "\n" + next_error->error_text;
- next_error = next_error->next_error;
- return true;
- }
- return false;
-}
-
-
-bool TeXErrors::getNextError(int *line, string *text)