X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLaTeX.C;h=8908812d6fe5cf683a7300190fa033b79c6dfa6f;hb=dbef37d5223a727b860a83ff4155f05b013c97a3;hp=797b316b56b214f90b141ecb75e9abfcce09fb3d;hpb=691568ea39ce8efc4a6e6e5461d3f65705cf2d72;p=lyx.git diff --git a/src/LaTeX.C b/src/LaTeX.C index 797b316b56..8908812d6f 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -13,10 +13,6 @@ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "LaTeX.h" #include "bufferlist.h" #include "gettext.h" @@ -25,6 +21,7 @@ #include "funcrequest.h" #include "support/filetools.h" #include "support/FileInfo.h" +#include "support/tostr.h" #include "support/lstrings.h" #include "support/lyxlib.h" #include "support/systemcall.h" @@ -32,7 +29,6 @@ #include "support/path.h" #include -#include "BoostFormat.h" #include #include // sscanf @@ -70,6 +66,16 @@ using boost::cmatch; extern BufferList bufferlist; +namespace { + +void showRunMessage(LyXFunc * lf, unsigned int count) +{ + string str = bformat(_("Waiting for LaTeX run number %1$s"), tostr(count)); + lf->dispatch(FuncRequest(LFUN_MESSAGE, str)); +} + + +}; /* * CLASS TEXERRORS */ @@ -81,6 +87,22 @@ void TeXErrors::insertError(int line, string const & error_desc, errors.push_back(newerr); } + +bool operator==(Aux_Info const & a, Aux_Info const & o) +{ + return a.aux_file == o.aux_file && + a.citations == o.citations && + a.databases == o.databases && + a.styles == o.styles; +} + + +bool operator!=(Aux_Info const & a, Aux_Info const & o) +{ + return !(a == o); +} + + /* * CLASS LaTeX */ @@ -141,7 +163,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) bool rerun = false; // rerun requested // The class LaTeX does not know the temp path. - bufferlist.updateIncludedTeXfiles(lyx::getcwd()); //GetCWD()); + bufferlist.updateIncludedTeXfiles(lyx::getcwd()); // Never write the depfile if an error was encountered. @@ -169,7 +191,10 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) if (had_depfile) { lyxerr[Debug::DEPEND] << "Dependency file exists" << endl; // Read the dep file: - head.read(depfile); + had_depfile = head.read(depfile); + } + + if (had_depfile) { // Update the checksums head.update(); // Can't just check if anything has changed because it might have aborted @@ -190,7 +215,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) run_bibtex = true; } else lyxerr[Debug::DEPEND] - << "Dependency file does not exist" << endl; + << "Dependency file does not exist, or has wrong format" << endl; /// We scan the aux file even when had_depfile = false, /// because we can run pdflatex on the file after running latex on it, @@ -202,20 +227,14 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) ++count; lyxerr[Debug::LATEX] << "Run #" << count << endl; if (lfun) { - ostringstream str; -#if USE_BOOST_FORMAT - str << boost::format(_("LaTeX run number %1$d")) % count; -#else - str << _("LaTeX run number ") << count; -#endif - lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str()))); + showRunMessage(lfun, count); } - this->operator()(); + startscript(); scanres = scanLogFile(terr); if (scanres & ERROR_RERUN) { lyxerr[Debug::LATEX] << "Rerunning LaTeX" << endl; - this->operator()(); + startscript(); scanres = scanLogFile(terr); } @@ -291,17 +310,10 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) lyxerr[Debug::LATEX] << "Run #" << count << endl; if (lfun) { - ostringstream str; -#if USE_BOOST_FORMAT - str << boost::format(_("LaTeX run number %1$d")) % count; -#else - str << _("LaTeX run number ") << count; -#endif - // check lyxstring string stream and gcc 3.1 before fixing - lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str()))); + showRunMessage(lfun, count); } - this->operator()(); + startscript(); scanres = scanLogFile(terr); if (scanres & ERRORS) { deleteFilesOnError(); @@ -352,16 +364,10 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) ++count; lyxerr[Debug::LATEX] << "Run #" << count << endl; if (lfun) { - ostringstream str; -#if USE_BOOST_FORMAT - str << boost::format(_("LaTeX run number %1$d")) % count; -#else - str << _("LaTeX run number ") << count; -#endif - lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str()))); + showRunMessage(lfun, count); } - this->operator()(); + startscript(); scanres = scanLogFile(terr); if (scanres & ERRORS) { deleteFilesOnError(); @@ -379,7 +385,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) } -int LaTeX::operator()() +int LaTeX::startscript() { #ifndef __EMX__ string tmp = cmd + ' ' + QuoteName(file) + " > /dev/null";