mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +00:00
Unicode: Do the conversion of error messages to docstring where they are read
in, because we don't know the encoding of external files. * src/LaTeX.C (LaTeX::scanLogFile): Convert error strings to docstring and add a comment that this could be wrong * src/Chktex.C (Chktex::scanLogFile): Ditto * src/LaTeX.h (TeXErrors::error_desc): Convert to docstring (TeXErrors::error_text): Convert to docstring * src/buffer_funcs.C (bufferErrors): no from_utf8 needed anymore git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15875 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
eca902c2bd
commit
ef91176cbf
23
src/Chktex.C
23
src/Chktex.C
@ -16,14 +16,13 @@
|
|||||||
#include "LaTeX.h" // TeXErrors
|
#include "LaTeX.h" // TeXErrors
|
||||||
|
|
||||||
#include "support/convert.h"
|
#include "support/convert.h"
|
||||||
|
#include "support/docstream.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "support/systemcall.h"
|
#include "support/systemcall.h"
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
@ -61,23 +60,25 @@ int Chktex::run(TeXErrors &terr)
|
|||||||
|
|
||||||
int Chktex::scanLogFile(TeXErrors & terr)
|
int Chktex::scanLogFile(TeXErrors & terr)
|
||||||
{
|
{
|
||||||
string token;
|
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
string const tmp = onlyFilename(changeExtension(file, ".log"));
|
string const tmp = onlyFilename(changeExtension(file, ".log"));
|
||||||
|
|
||||||
#if USE_BOOST_FORMAT
|
#if USE_BOOST_FORMAT
|
||||||
boost::format msg(to_utf8(_("ChkTeX warning id # %1$d")));
|
boost::basic_format<char_type> msg(_("ChkTeX warning id # %1$d"));
|
||||||
#else
|
#else
|
||||||
string const msg(to_utf8(_("ChkTeX warning id # ")));
|
docstring const msg(_("ChkTeX warning id # "));
|
||||||
#endif
|
#endif
|
||||||
ifstream ifs(tmp.c_str());
|
docstring token;
|
||||||
|
// FIXME UNICODE
|
||||||
|
// We have no idea what the encoding of the error file is
|
||||||
|
idocfstream ifs(tmp.c_str());
|
||||||
while (getline(ifs, token)) {
|
while (getline(ifs, token)) {
|
||||||
string srcfile;
|
docstring srcfile;
|
||||||
string line;
|
docstring line;
|
||||||
string pos;
|
docstring pos;
|
||||||
string warno;
|
docstring warno;
|
||||||
string warning;
|
docstring warning;
|
||||||
token = split(token, srcfile, ':');
|
token = split(token, srcfile, ':');
|
||||||
token = split(token, line, ':');
|
token = split(token, line, ':');
|
||||||
token = split(token, pos, ':');
|
token = split(token, pos, ':');
|
||||||
|
10
src/LaTeX.C
10
src/LaTeX.C
@ -95,8 +95,8 @@ docstring runMessage(unsigned int count)
|
|||||||
* CLASS TEXERRORS
|
* CLASS TEXERRORS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void TeXErrors::insertError(int line, string const & error_desc,
|
void TeXErrors::insertError(int line, docstring const & error_desc,
|
||||||
string const & error_text)
|
docstring const & error_text)
|
||||||
{
|
{
|
||||||
Error newerr(line, error_desc, error_text);
|
Error newerr(line, error_desc, error_text);
|
||||||
errors.push_back(newerr);
|
errors.push_back(newerr);
|
||||||
@ -671,7 +671,11 @@ int LaTeX::scanLogFile(TeXErrors & terr)
|
|||||||
last_line = line;
|
last_line = line;
|
||||||
}
|
}
|
||||||
if (line_count <= 5) {
|
if (line_count <= 5) {
|
||||||
terr.insertError(line, desc, errstr);
|
// FIXME UNICODE
|
||||||
|
// We have no idea what the encoding of the log file is
|
||||||
|
// (probably pure ascii, but maybe some localized
|
||||||
|
// latex compilers or packages exist)
|
||||||
|
terr.insertError(line, from_utf8(desc), from_utf8(errstr));
|
||||||
++num_errors;
|
++num_errors;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
10
src/LaTeX.h
10
src/LaTeX.h
@ -38,16 +38,16 @@ private:
|
|||||||
///
|
///
|
||||||
Error () : error_in_line(0) {}
|
Error () : error_in_line(0) {}
|
||||||
///
|
///
|
||||||
Error(int line, std::string const & desc, std::string const & text)
|
Error(int line, docstring const & desc, docstring const & text)
|
||||||
: error_in_line(line),
|
: error_in_line(line),
|
||||||
error_desc(desc),
|
error_desc(desc),
|
||||||
error_text(text) {}
|
error_text(text) {}
|
||||||
/// what line in the TeX file the error occured in
|
/// what line in the TeX file the error occured in
|
||||||
int error_in_line;
|
int error_in_line;
|
||||||
/// The kind of error
|
/// The kind of error
|
||||||
std::string error_desc;
|
docstring error_desc;
|
||||||
/// The line/cmd that caused the error.
|
/// The line/cmd that caused the error.
|
||||||
std::string error_text;
|
docstring error_text;
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
@ -57,8 +57,8 @@ public:
|
|||||||
///
|
///
|
||||||
Errors::const_iterator end() const { return errors.end(); }
|
Errors::const_iterator end() const { return errors.end(); }
|
||||||
///
|
///
|
||||||
void insertError(int line, std::string const & error_desc,
|
void insertError(int line, docstring const & error_desc,
|
||||||
std::string const & error_text);
|
docstring const & error_text);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
Errors errors;
|
Errors errors;
|
||||||
|
@ -233,8 +233,8 @@ void bufferErrors(Buffer const & buf, TeXErrors const & terr,
|
|||||||
pos_end);
|
pos_end);
|
||||||
} while (found && id_start == id_end && pos_start == pos_end);
|
} while (found && id_start == id_end && pos_start == pos_end);
|
||||||
|
|
||||||
errorList.push_back(ErrorItem(from_utf8(cit->error_desc),
|
errorList.push_back(ErrorItem(cit->error_desc,
|
||||||
from_utf8(cit->error_text), id_start, pos_start, pos_end));
|
cit->error_text, id_start, pos_start, pos_end));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user