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 <boost/utility.hpp>
20 #include <boost/signal.hpp>
34 Error () : error_in_line(0) {}
36 Error(int line, std::string const & desc, std::string const & text)
37 : error_in_line(line),
40 /// what line in the TeX file the error occured in
43 std::string error_desc;
44 /// The line/cmd that caused the error.
45 std::string error_text;
49 typedef std::vector<Error> Errors;
51 Errors::const_iterator begin() const { return errors.begin(); }
53 Errors::const_iterator end() const { return errors.end(); }
55 void insertError(int line, std::string const & error_desc,
56 std::string const & error_text);
70 std::set<std::string> citations;
72 std::set<std::string> databases;
74 std::set<std::string> styles;
79 bool operator==(Aux_Info const &, Aux_Info const &);
80 bool operator!=(Aux_Info const &, Aux_Info const &);
84 class LaTeX : boost::noncopyable {
86 /** Return values from scanLogFile() and run() (to come)
88 This enum should be enlarged a bit so that one could
89 get more feedback from the LaTeX run.
99 UNDEF_REF = 4, // Reference '...' on page ... undefined.
101 UNDEF_CIT = 8, // Citation '...' on page ... undefined.
103 RERUN = 16, // Label(s) may have changed. Rerun to get...
113 PACKAGE_WARNING = 512,
119 TOO_MANY_ERRORS = 4096,
123 ERRORS = TEX_ERROR + LATEX_ERROR,
125 WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING
128 /// This signal emits an informative message
129 boost::signal<void(std::string)> message;
133 cmd = the latex command, file = name of the (temporary) latex file,
134 path = name of the files original path.
136 LaTeX(std::string const & cmd, OutputParams const &,
137 std::string const & file, std::string const & path);
139 /// runs LaTeX several times
140 int run(TeXErrors &);
143 int getNumErrors() { return num_errors;}
146 int scanLogFile(TeXErrors &);
149 /// use this for running LaTeX once
152 /// The dependency file.
156 void deplog(DepTable & head);
159 bool runMakeIndex(std::string const &, OutputParams const &);
162 std::vector<Aux_Info> const scanAuxFiles(std::string const &);
165 Aux_Info const scanAuxFile(std::string const &);
168 void scanAuxFile(std::string const &, Aux_Info &);
171 void updateBibtexDependencies(DepTable &,
172 std::vector<Aux_Info> const &);
175 bool runBibTeX(std::vector<Aux_Info> const &);
178 void deleteFilesOnError() const;
189 /// used by scanLogFile
192 /// The name of the final output file.
193 std::string output_file;
196 OutputParams runparams;