This commit was manufactured by cvs2svn to create tag
[lyx.git] / src / LaTeX.h
blobe81348eca58902d4f5c841cde009af88fbda2b8f
1 // -*- C++ -*-
2 /* This file is part of
3 * ======================================================
4 *
5 * LyX, The Document Processor
6 * Copyright 1995 Matthias Ettrich
7 * Copyright 1995-1996 The Lyx Team
9 * This file is Copyright (C) 1996-1999
10 * Lars Gullik Bjønnes
12 *======================================================
15 #ifndef LATEX_H
16 #define LATEX_H
18 #ifdef __GNUG__
19 #pragma interface
20 #endif
22 #include "LString.h"
23 #include "DepTable.h"
24 #include <vector>
25 #include <fstream>
27 class MiniBuffer;
29 ///
30 class TeXErrors {
31 private:
32 ///
33 struct Error {
34 ///
35 Error () : error_in_line(0) {}
36 ///
37 Error(int line, string const & desc, string const & text)
38 : error_in_line(line),
39 error_desc(desc),
40 error_text(text) {}
41 /// what line in the TeX file the error occured in
42 int error_in_line;
43 /// The kind of error
44 string error_desc;
45 /// The line/cmd that caused the error.
46 string error_text;
48 public:
49 ///
50 typedef vector<Error> Errors;
51 ///
52 Errors::const_iterator begin() const { return errors.begin(); }
53 ///
54 Errors::const_iterator end() const { return errors.end(); }
55 ///
56 void insertError(int line, string const & error_desc,
57 string const & error_text);
58 private:
59 ///
60 Errors errors;
64 ///
65 class LaTeX {
66 public:
67 /** All the different files produced by TeX.
69 This is the files mentioned on page 208-9 in Lamports book +
70 .ltx and .tex files.
72 enum TEX_FILES {
73 ///
74 NO_FILES = 0,
75 /// used for table of contents et.al.
76 AUX = 1,
77 /// written by BibTeX
78 BBL = 2,
79 /// LaTeX's output
80 DVI = 4,
81 /// glossary (not supported by LyX so far)
82 GLO = 8,
83 ///index
84 IDX = 16,
85 /// written by makeindex
86 IND = 32,
87 /// list of figures
88 LOF = 64,
89 /// the LaTeX log file
90 LOG = 128,
91 /// list of tables
92 LOT = 256,
93 /// table of contents
94 TOC = 512,
95 /// latex files
96 LTX = 1024,
97 /// tex files
98 TEX = 2048,
99 /// list of algorithms
100 LOA = 4096
103 /** Return values from scanLogFile() and run() (to come)
105 This enum should be enlarged a bit so that one could
106 get more feedback from the LaTeX run.
108 enum log_status {
110 NO_ERRORS = 0,
112 NO_LOGFILE = 1,
114 NO_OUTPUT = 2,
116 UNDEF_REF = 4, // Reference '...' on page ... undefined.
118 UNDEF_CIT = 8, // Citation '...' on page ... undefined.
120 RERUN = 16, // Label(s) may have changed. Rerun to get...
122 TEX_ERROR = 32,
124 TEX_WARNING = 64,
126 LATEX_ERROR = 128,
128 LATEX_WARNING = 256,
130 PACKAGE_WARNING = 512,
132 NO_FILE = 1024,
134 NO_CHANGE = 2048,
136 TOO_MANY_ERRORS = 4096,
138 ERRORS = TEX_ERROR + LATEX_ERROR,
140 WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING
145 cmd = the latex command, file = name of the (temporary) latex file,
146 path = name of the files original path.
148 LaTeX(string const & cmd, string const & file, string const & path);
150 /// runs LaTeX several times
151 int run(TeXErrors &, MiniBuffer *);
154 int getNumErrors() { return num_errors;}
156 /// use this for running LaTeX once
157 int operator() ();
158 protected:
159 /// The dependency file.
160 string depfile;
162 /// unavail
163 LaTeX(LaTeX const &);
164 /// unavail
165 LaTeX & operator=(LaTeX const &);
168 void deplog(DepTable & head);
171 void deptex(DepTable & head);
174 int scanLogFile(TeXErrors &);
177 bool runMakeIndex(string const &);
180 bool runBibTeX(string const &, DepTable &);
183 string cmd;
186 string file;
189 string path;
191 TEX_FILES tex_files;
194 int file_count;
196 // used by scanLogFile
197 int num_errors;
200 #endif