- * ======================================================
- *
- * LyX, The Document Processor
+ * ======================================================
+ *
+ * LyX, The Document Processor
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
* This file is Copyright 1996-2001
* Lars Gullik Bjønnes
*
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
* This file is Copyright 1996-2001
* Lars Gullik Bjønnes
*
#include "support/LRegex.h"
#include "support/LSubstring.h"
#include "support/lstrings.h"
#include "support/LRegex.h"
#include "support/LSubstring.h"
#include "support/lstrings.h"
-#include "bufferlist.h"
-#include "gettext.h"
-#include "lyx_gui_misc.h"
-#include "lyxfunc.h"
+#include "support/lyxlib.h"
+#include "support/systemcall.h"
+#include "support/os.h"
+#include "support/path.h"
+#include <cstdio> // sscanf
void TeXErrors::insertError(int line, string const & error_desc,
string const & error_text)
{
void TeXErrors::insertError(int line, string const & error_desc,
string const & error_text)
{
// Also remove the aux file
string aux = ChangeExtension(ofname, ".aux");
lyx::unlink(aux);
// Also remove the aux file
string aux = ChangeExtension(ofname, ".aux");
lyx::unlink(aux);
const unsigned int MAX_RUN = 6;
DepTable head; // empty head
bool rerun = false; // rerun requested
const unsigned int MAX_RUN = 6;
DepTable head; // empty head
bool rerun = false; // rerun requested
// The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(lyx::getcwd()); //GetCWD());
// The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(lyx::getcwd()); //GetCWD());
str << _("LaTeX run number") << ' ' << count;
lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
}
str << _("LaTeX run number") << ' ' << count;
lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
}
// And if there were undefined citations or changes in references
// the .aux file is checked for signs of bibtex. Bibtex is then run
// if needed.
// And if there were undefined citations or changes in references
// the .aux file is checked for signs of bibtex. Bibtex is then run
// if needed.
updateBibtexDependencies(head, bibtex_info);
rerun |= runBibTeX(bibtex_info);
} else if (!had_depfile) {
updateBibtexDependencies(head, bibtex_info);
rerun |= runBibTeX(bibtex_info);
} else if (!had_depfile) {
/// insert the .bib and .bst files into the .dep-pdf file.
updateBibtexDependencies(head, bibtex_info);
}
/// insert the .bib and .bst files into the .dep-pdf file.
updateBibtexDependencies(head, bibtex_info);
}
// 1
// we know on this point that latex has been run once (or we just
// returned) and the question now is to decide if we need to run
// 1
// we know on this point that latex has been run once (or we just
// returned) and the question now is to decide if we need to run
str << _("LaTeX run number") << ' ' << count;
lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
}
str << _("LaTeX run number") << ' ' << count;
lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
}
// again to make sure everything is redone correctly.
// Also there should be no need to run the external programs any
// more after this.
// again to make sure everything is redone correctly.
// Also there should be no need to run the external programs any
// more after this.
// run makeindex if the <file>.idx has changed or was generated.
if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) {
// no checks for now
// run makeindex if the <file>.idx has changed or was generated.
if (head.haschanged(OnlyFilename(ChangeExtension(file, ".idx")))) {
// no checks for now
str << _("LaTeX run number") << ' ' << count;
lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
}
str << _("LaTeX run number") << ' ' << count;
lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
}
#else // cmd.exe (OS/2) causes SYS0003 error at "/dev/null"
string tmp = cmd + ' ' + file + " > nul";
#endif
#else // cmd.exe (OS/2) causes SYS0003 error at "/dev/null"
string tmp = cmd + ' ' + file + " > nul";
#endif
string token;
while (getline(ifs, token)) {
lyxerr[Debug::LATEX] << "Log line: " << token << endl;
string token;
while (getline(ifs, token)) {
lyxerr[Debug::LATEX] << "Log line: " << token << endl;
// Writing index file sample.idx
LRegex reg5("Writing index file ([^ ]+).*");
LRegex unwanted("^.*\\.(aux|log|dvi|bbl|ind|glo)$");
// Writing index file sample.idx
LRegex reg5("Writing index file ([^ ]+).*");
LRegex unwanted("^.*\\.(aux|log|dvi|bbl|ind|glo)$");
ifstream ifs(logfile.c_str());
while (ifs) {
// Ok, the scanning of files here is not sufficient.
ifstream ifs(logfile.c_str());
while (ifs) {
// Ok, the scanning of files here is not sufficient.
getline(ifs, token);
token = strip(token, '\r');
if (token.empty()) continue;
getline(ifs, token);
token = strip(token, '\r');
if (token.empty()) continue;
if (reg1.exact_match(token)) {
LRegex::SubMatches const & sub = reg1.exec(token);
foundfile = LSubstring(token, sub[1].first,
if (reg1.exact_match(token)) {
LRegex::SubMatches const & sub = reg1.exec(token);
foundfile = LSubstring(token, sub[1].first,
// Ok now we found a file.
// Now we should make sure that this is a file that we can
// access through the normal paths.
// We will not try any fancy search methods to
// find the file.
// Ok now we found a file.
// Now we should make sure that this is a file that we can
// access through the normal paths.
// We will not try any fancy search methods to
// find the file.
<< foundfile << endl;
// On initial insert we want to do the update at once
// since this file can not be a file generated by
<< foundfile << endl;
// On initial insert we want to do the update at once
// since this file can not be a file generated by