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 NONZERO_ERROR = 32768, // the command exited with nonzero status
143 ERRORS = TEX_ERROR + LATEX_ERROR + NONZERO_ERROR + BIBTEX_ERROR,
145 WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING
148 /// This signal emits an informative message
149 boost::signal<void(docstring)> message;
153 cmd = the latex command, file = name of the (temporary) latex file,
154 path = name of the files original path.
156 LaTeX(std::string const & cmd, OutputParams const &,
157 support::FileName const & file,
158 std::string const & path = empty_string());
160 /// runs LaTeX several times
161 int run(TeXErrors &);
164 int getNumErrors() { return num_errors;}
167 int scanLogFile(TeXErrors &);
171 LaTeX(LaTeX const &);
172 void operator=(LaTeX const &);
174 /// use this for running LaTeX once
177 /// The dependency file.
178 support::FileName depfile;
181 void deplog(DepTable & head);
184 bool runMakeIndex(std::string const &, OutputParams const &,
185 std::string const & = std::string());
188 bool runMakeIndexNomencl(support::FileName const &,
189 std::string const &, std::string const &);
192 std::vector<AuxInfo> const scanAuxFiles(support::FileName const &);
195 AuxInfo const scanAuxFile(support::FileName const &);
198 void scanAuxFile(support::FileName const &, AuxInfo &);
201 void updateBibtexDependencies(DepTable &,
202 std::vector<AuxInfo> const &);
205 int scanBlgFile(DepTable & head, TeXErrors & terr);
208 bool runBibTeX(std::vector<AuxInfo> const &,
209 OutputParams const &);
212 void deleteFilesOnError() const;
218 support::FileName file;
223 /// used by scanLogFile
226 /// The name of the final output file.
227 support::FileName output_file;
230 OutputParams runparams;