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"
21 #include <boost/utility.hpp>
22 #include <boost/signal.hpp>
39 Error () : error_in_line(0) {}
41 Error(int line, std::string const & desc, std::string const & text)
42 : error_in_line(line),
45 /// what line in the TeX file the error occured in
48 std::string error_desc;
49 /// The line/cmd that caused the error.
50 std::string error_text;
54 typedef std::vector<Error> Errors;
56 Errors::const_iterator begin() const { return errors.begin(); }
58 Errors::const_iterator end() const { return errors.end(); }
60 void insertError(int line, std::string const & error_desc,
61 std::string const & error_text);
75 std::set<std::string> citations;
77 std::set<std::string> databases;
79 std::set<std::string> styles;
84 bool operator==(Aux_Info const &, Aux_Info const &);
85 bool operator!=(Aux_Info const &, Aux_Info const &);
89 class LaTeX : boost::noncopyable {
91 /** Return values from scanLogFile() and run() (to come)
93 This enum should be enlarged a bit so that one could
94 get more feedback from the LaTeX run.
104 UNDEF_REF = 4, // Reference '...' on page ... undefined.
106 UNDEF_CIT = 8, // Citation '...' on page ... undefined.
108 RERUN = 16, // Label(s) may have changed. Rerun to get...
118 PACKAGE_WARNING = 512,
124 TOO_MANY_ERRORS = 4096,
128 ERRORS = TEX_ERROR + LATEX_ERROR,
130 WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING
133 /// This signal emits an informative message
134 boost::signal<void(docstring)> message;
138 cmd = the latex command, file = name of the (temporary) latex file,
139 path = name of the files original path.
141 LaTeX(std::string const & cmd, OutputParams const &,
142 std::string const & file, std::string const & path);
144 /// runs LaTeX several times
145 int run(TeXErrors &);
148 int getNumErrors() { return num_errors;}
151 int scanLogFile(TeXErrors &);
154 /// use this for running LaTeX once
157 /// The dependency file.
161 void deplog(DepTable & head);
164 bool runMakeIndex(std::string const &, OutputParams const &,
165 std::string const & = std::string());
168 std::vector<Aux_Info> const scanAuxFiles(std::string const &);
171 Aux_Info const scanAuxFile(std::string const &);
174 void scanAuxFile(std::string const &, Aux_Info &);
177 void updateBibtexDependencies(DepTable &,
178 std::vector<Aux_Info> const &);
181 bool runBibTeX(std::vector<Aux_Info> const &);
184 void deleteFilesOnError() const;
195 /// used by scanLogFile
198 /// The name of the final output file.
199 std::string output_file;
202 OutputParams runparams;