+2000-04-28 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * src/lyx_main.C (easyParse): use lyxerr instead of cerr.
+
+ * src/lyx_cb.C: add using std::reverse;
+
+ * src/LaTeX.C (run): on error always run deleteFilesOnError before
+ returning.
+
+ * src/LaTeX.[Ch] (deleteFilesOnError): new method. unlinks some
+ selected files. Should fix repeated errors from generated files.
+
2000-04-27 Dekel Tsur <dekel@math.tau.ac.il>
* src/lyx_cb.C (TocUpdateCB): Reverse strings for Hebrew paragraphs
}
+void LaTeX::deleteFilesOnError() const
+{
+ // currently just a dummy function.
+
+ // What files do we have to delete?
+
+ // This will at least make latex do all the runs
+ ::unlink(depfile.c_str());
+
+ // but the reason for the error might be in a generated file...
+
+ // bibtex file
+ string bbl = ChangeExtension(file, ".bbl", true);
+ ::unlink(bbl.c_str());
+
+ // makeindex file
+ string ind = ChangeExtension(file, ".ind", true);
+ ::unlink(ind.c_str());
+
+ // Also remove the aux file
+ string aux = ChangeExtension(file, ".aux", true);
+ ::unlink(aux.c_str());
+}
+
+
int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
// We know that this function will only be run if the lyx buffer
// has been changed. We also know that a newly written .tex file
minib->Store();
this->operator()();
scanres = scanLogFile(terr);
- if (scanres & LaTeX::ERRORS) return scanres; // return on error
+ if (scanres & LaTeX::ERRORS) {
+ deleteFilesOnError();
+ return scanres; // return on error
+ }
+
run_bibtex = scanAux(head);
if (run_bibtex)
lyxerr[Debug::DEPEND]
++count;
lyxerr[Debug::DEPEND]
<< "Dependency file does not exist" << endl;
+
lyxerr[Debug::LATEX]
<< "Run #" << count << endl;
head.insert(file, true);
minib->Store();
this->operator()();
scanres = scanLogFile(terr);
- if (scanres & LaTeX::ERRORS) return scanres; // return on error
+ if (scanres & LaTeX::ERRORS) {
+ deleteFilesOnError();
+ return scanres; // return on error
+ }
+
}
// update the dependencies.
minib->Store();
this->operator()();
scanres = scanLogFile(terr);
- if (scanres & LaTeX::ERRORS) return scanres; // return on error
+ if (scanres & LaTeX::ERRORS) {
+ deleteFilesOnError();
+ return scanres; // return on error
+ }
+
// update the depedencies
deplog(head); // reads the latex log
head.update();
minib->Store();
this->operator()();
scanres = scanLogFile(terr);
- if (scanres & LaTeX::ERRORS) return scanres; // return on error
+ if (scanres & LaTeX::ERRORS) {
+ deleteFilesOnError();
+ return scanres; // return on error
+ }
+
// keep this updated
head.update();
}
using std::ios;
using std::istream_iterator;
using std::pair;
+using std::reverse;
extern Combox * combo_language;
extern Combox * combo_language2;
++i;
}
if (par->isRightToLeftPar())
- reverse(line+pos0,line+pos);
+ reverse(line + pos0, line + pos);
+
line[pos] = '\0';
fl_add_browser_line(fd_form_toc->browser_toc, line);
--i; // After shift, check this number again.
batch_command = "buffer-import " + type + " " + file;
- cerr << "batch_command: " << batch_command << endl;
+ lyxerr << "batch_command: "
+ << batch_command << endl;
} else
lyxerr << _("Missing type [eg latex, "