X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FChktex.C;h=bb9258c207d60c570e0e835bbe7b4454f31f827c;hb=9ee46b846e5e84ad40ceda4f4af94aeb86cd90a2;hp=f9752dac258479543fee37734e9de278c9679aaf;hpb=b016d9d77324649f6fef8af9bb1c871fb7dafa33;p=lyx.git diff --git a/src/Chktex.C b/src/Chktex.C index f9752dac25..bb9258c207 100644 --- a/src/Chktex.C +++ b/src/Chktex.C @@ -1,44 +1,38 @@ -/* This file is part of - * ====================================================== +/** + * \file Chktex.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * LyX, The Document Processor - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2001 The LyX Team. + * \author Asger Alstrup * - * This file is Copyright 1997-1998 - * Asger Alstrup - * - * ====================================================== + * Full author contact details are available in file CREDITS. */ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "Chktex.h" -#include "LaTeX.h" // TeXErrors -#include "lyxlex.h" -#include "debug.h" #include "gettext.h" -#include "support/FileInfo.h" +#include "LaTeX.h" // TeXErrors + +#include "support/convert.h" #include "support/filetools.h" -#include "support/systemcall.h" -#include "support/path.h" #include "support/lstrings.h" +#include "support/systemcall.h" -#include "BoostFormat.h" +#include #include -using std::ifstream; +using lyx::support::ChangeExtension; +using lyx::support::OnlyFilename; +using lyx::support::split; +using lyx::support::Systemcall; + using std::getline; +using std::string; +using std::ifstream; -/* - * CLASS Chktex - */ Chktex::Chktex(string const & chktex, string const & f, string const & p) : cmd(chktex), file(f), path(p) @@ -52,7 +46,7 @@ int Chktex::run(TeXErrors &terr) 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); + int result = one.startscript(Systemcall::Wait, tmp); if (result == 0) { result = scanLogFile(terr); } else { @@ -67,8 +61,13 @@ int Chktex::scanLogFile(TeXErrors & terr) string token; int retval = 0; - string tmp = OnlyFilename(ChangeExtension(file, ".log")); + string const tmp = OnlyFilename(ChangeExtension(file, ".log")); +#if USE_BOOST_FORMAT + boost::format msg(_("ChkTeX warning id # %1$d")); +#else + string const msg(_("ChkTeX warning id # ")); +#endif ifstream ifs(tmp.c_str()); while (getline(ifs, token)) { string srcfile; @@ -82,9 +81,16 @@ int Chktex::scanLogFile(TeXErrors & terr) token = split(token, warno, ':'); token = split(token, warning, ':'); - int lineno = lyx::atoi(line); - warno = boost::io::str(boost::format(_("ChkTeX warning id # %1$d")) % warno); - terr.insertError(lineno, warno, warning); + int const lineno = convert(line); + +#if USE_BOOST_FORMAT + msg % warno; + terr.insertError(lineno, msg.str(), warning); + msg.clear(); +#else + terr.insertError(lineno, msg + warno, warning); +#endif + ++retval; } return retval;