X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FChktex.C;h=09c48a7eabe1a45963a5e7d861c3439839d6df72;hb=2734cc154853c61a7ea54bfeea3adc908f68bdc5;hp=9d3b7262087fc7f99faf4b269d8f1f99c3f57f9a;hpb=cd03e2b7db8379a91f3d31eac2c5bc25b159c541;p=lyx.git diff --git a/src/Chktex.C b/src/Chktex.C index 9d3b726208..09c48a7eab 100644 --- a/src/Chktex.C +++ b/src/Chktex.C @@ -15,22 +15,24 @@ #include "LaTeX.h" // TeXErrors -#include "support/BoostFormat.h" +#include "support/convert.h" +#include "support/docstream.h" #include "support/filetools.h" #include "support/lstrings.h" -#include "support/lyxlib.h" #include "support/systemcall.h" -#include +#include -using lyx::support::atoi; -using lyx::support::ChangeExtension; -using lyx::support::OnlyFilename; -using lyx::support::split; -using lyx::support::Systemcall; -using std::getline; +namespace lyx { + +using support::changeExtension; +using support::onlyFilename; +using support::split; +using support::Systemcall; +using std::getline; +using std::string; using std::ifstream; @@ -43,7 +45,7 @@ Chktex::Chktex(string const & chktex, string const & f, string const & p) int Chktex::run(TeXErrors &terr) { // run bibtex - string log = OnlyFilename(ChangeExtension(file, ".log")); + string log = onlyFilename(changeExtension(file, ".log")); string tmp = cmd + " -q -v0 -b0 -x " + file + " -o " + log; Systemcall one; int result = one.startscript(Systemcall::Wait, tmp); @@ -58,30 +60,32 @@ int Chktex::run(TeXErrors &terr) int Chktex::scanLogFile(TeXErrors & terr) { - string token; int retval = 0; - string const tmp = OnlyFilename(ChangeExtension(file, ".log")); + string const tmp = onlyFilename(changeExtension(file, ".log")); #if USE_BOOST_FORMAT - boost::format msg(_("ChkTeX warning id # %1$d")); + boost::basic_format msg(_("ChkTeX warning id # %1$d")); #else - string const msg(_("ChkTeX warning id # ")); + docstring const msg(_("ChkTeX warning id # ")); #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)) { - string srcfile; - string line; - string pos; - string warno; - string warning; + docstring srcfile; + docstring line; + docstring pos; + docstring warno; + docstring warning; token = split(token, srcfile, ':'); token = split(token, line, ':'); token = split(token, pos, ':'); token = split(token, warno, ':'); token = split(token, warning, ':'); - int const lineno = atoi(line); + int const lineno = convert(line); #if USE_BOOST_FORMAT msg % warno; @@ -95,3 +99,6 @@ int Chktex::scanLogFile(TeXErrors & terr) } return retval; } + + +} // namespace lyx