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/signal.hpp>
39 Error () : error_in_line(0) {}
41 Error(int line, docstring const & desc, docstring const & text,
42 std::string const & fname)
43 : error_in_line(line),
47 /// what line in the TeX file the error occurred in
51 /// The line/cmd that caused the error.
53 /// The name of the child where error occurred, empty otherwise.
54 std::string child_name;
58 typedef std::vector<Error> Errors;
60 Errors::const_iterator begin() const { return errors.begin(); }
62 Errors::const_iterator end() const { return errors.end(); }
64 void insertError(int line, docstring const & error_desc,
65 docstring const & error_text,
66 std::string const & child_name = empty_string());
78 support::FileName aux_file;
80 std::set<std::string> citations;
82 std::set<std::string> databases;
84 std::set<std::string> styles;
89 bool operator==(AuxInfo const &, AuxInfo const &);
90 bool operator!=(AuxInfo const &, AuxInfo const &);
94 * Class to run the LaTeX compiler and needed auxiliary programs.
95 * The main .tex file must be in the current directory. The current directory
96 * must not change as long as an object of this class lives.
97 * This is required by the LaTeX compiler, and we also make use of it by
98 * various support::makeAbsPath() calls.
102 /** Return values from scanLogFile() and run() (to come)
104 This enum should be enlarged a bit so that one could
105 get more feedback from the LaTeX run.
115 UNDEF_REF = 4, // Reference '...' on page ... undefined.
117 UNDEF_CIT = 8, // Citation '...' on page ... undefined.
119 RERUN = 16, // Label(s) may have changed. Rerun to get...
129 PACKAGE_WARNING = 512,
135 TOO_MANY_ERRORS = 4096,
139 BIBTEX_ERROR = 16384,
141 //FIXME: BIBTEX_ERROR has been removed from ERRORS for now, since users were irritated
142 // about those errors which prevented compilation of previously compiling documents.
143 // Think about a "gentle" transfer to BibTeX error reporting.
144 ERRORS = TEX_ERROR + LATEX_ERROR,
146 WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING
149 /// This signal emits an informative message
150 boost::signal<void(docstring)> message;
154 cmd = the latex command, file = name of the (temporary) latex file,
155 path = name of the files original path.
157 LaTeX(std::string const & cmd, OutputParams const &,
158 support::FileName const & file,
159 std::string const & path = empty_string());
161 /// runs LaTeX several times
162 int run(TeXErrors &);
165 int getNumErrors() { return num_errors;}
168 int scanLogFile(TeXErrors &);
172 LaTeX(LaTeX const &);
173 void operator=(LaTeX const &);
175 /// use this for running LaTeX once
178 /// The dependency file.
179 support::FileName depfile;
182 void deplog(DepTable & head);
185 bool runMakeIndex(std::string const &, OutputParams const &,
186 std::string const & = std::string());
189 bool runMakeIndexNomencl(support::FileName const &,
190 std::string const &, std::string const &);
193 std::vector<AuxInfo> const scanAuxFiles(support::FileName const &);
196 AuxInfo const scanAuxFile(support::FileName const &);
199 void scanAuxFile(support::FileName const &, AuxInfo &);
202 void updateBibtexDependencies(DepTable &,
203 std::vector<AuxInfo> const &);
206 int scanBlgFile(DepTable & head, TeXErrors & terr);
209 bool runBibTeX(std::vector<AuxInfo> const &,
210 OutputParams const &);
213 void deleteFilesOnError() const;
219 support::FileName file;
224 /// used by scanLogFile
227 /// The name of the final output file.
228 support::FileName output_file;
231 OutputParams runparams;