4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Angus Leeming
11 * Full author contact details are available in file CREDITS.
17 #include "outputparams.h"
19 #include "support/docstring.h"
20 #include "support/filename.h"
22 #include <boost/utility.hpp>
23 #include <boost/signal.hpp>
40 Error () : error_in_line(0) {}
42 Error(int line, docstring const & desc, docstring const & text)
43 : error_in_line(line),
46 /// what line in the TeX file the error occured in
50 /// The line/cmd that caused the error.
55 typedef std::vector<Error> Errors;
57 Errors::const_iterator begin() const { return errors.begin(); }
59 Errors::const_iterator end() const { return errors.end(); }
61 void insertError(int line, docstring const & error_desc,
62 docstring const & error_text);
76 std::set<std::string> citations;
78 std::set<std::string> databases;
80 std::set<std::string> styles;
85 bool operator==(Aux_Info const &, Aux_Info const &);
86 bool operator!=(Aux_Info const &, Aux_Info const &);
90 class LaTeX : boost::noncopyable {
92 /** Return values from scanLogFile() and run() (to come)
94 This enum should be enlarged a bit so that one could
95 get more feedback from the LaTeX run.
105 UNDEF_REF = 4, // Reference '...' on page ... undefined.
107 UNDEF_CIT = 8, // Citation '...' on page ... undefined.
109 RERUN = 16, // Label(s) may have changed. Rerun to get...
119 PACKAGE_WARNING = 512,
125 TOO_MANY_ERRORS = 4096,
129 ERRORS = TEX_ERROR + LATEX_ERROR,
131 WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING
134 /// This signal emits an informative message
135 boost::signal<void(docstring)> message;
139 cmd = the latex command, file = name of the (temporary) latex file,
140 path = name of the files original path.
142 LaTeX(std::string const & cmd, OutputParams const &,
143 std::string const & file, std::string const & path);
145 /// runs LaTeX several times
146 int run(TeXErrors &);
149 int getNumErrors() { return num_errors;}
152 int scanLogFile(TeXErrors &);
155 /// use this for running LaTeX once
158 /// The dependency file.
159 support::FileName depfile;
162 void deplog(DepTable & head);
165 bool runMakeIndex(std::string const &, OutputParams const &,
166 std::string const & = std::string());
169 std::vector<Aux_Info> const scanAuxFiles(std::string const &);
172 Aux_Info const scanAuxFile(std::string const &);
175 void scanAuxFile(support::FileName const &, Aux_Info &);
178 void updateBibtexDependencies(DepTable &,
179 std::vector<Aux_Info> const &);
182 bool runBibTeX(std::vector<Aux_Info> const &);
185 void deleteFilesOnError() const;
196 /// used by scanLogFile
199 /// The name of the final output file.
200 std::string output_file;
203 OutputParams runparams;