X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FChktex.C;h=1e7f62d2bc7724506ecaa9f364aff8fd13fcd51a;hb=dad1fc66e44a4dad94eb1e9ffd5736bf8f59ae6d;hp=1193c7590a72eb39c9ba92f13ef25b3dd2c75a4b;hpb=7aebbe6e10b3b4cf1f110b98c73a0a27059da6d8;p=lyx.git diff --git a/src/Chktex.C b/src/Chktex.C index 1193c7590a..1e7f62d2bc 100644 --- a/src/Chktex.C +++ b/src/Chktex.C @@ -1,22 +1,18 @@ /* This file is part of - * ====================================================== - * - * LyX, The Document Processor + * ====================================================== + * + * LyX, The Document Processor * Copyright 1995 Matthias Ettrich * Copyright 1995-2001 The LyX Team. * * This file is Copyright 1997-1998 * Asger Alstrup * - * ====================================================== + * ====================================================== */ #include -#ifdef __GNUG__ -#pragma implementation -#endif - #include "Chktex.h" #include "LaTeX.h" // TeXErrors #include "lyxlex.h" @@ -25,11 +21,12 @@ #include "support/FileInfo.h" #include "support/filetools.h" -#include "support/syscall.h" -#include "support/syscontr.h" +#include "support/systemcall.h" #include "support/path.h" #include "support/lstrings.h" +#include "BoostFormat.h" + #include using std::ifstream; @@ -50,8 +47,8 @@ int Chktex::run(TeXErrors &terr) // run bibtex string log = OnlyFilename(ChangeExtension(file, ".log")); string tmp = cmd + " -q -v0 -b0 -x " + file + " -o " + log; - Systemcalls one; - int result= one.startscript(Systemcalls::System, tmp); + Systemcall one; + int result= one.startscript(Systemcall::Wait, tmp); if (result == 0) { result = scanLogFile(terr); } else { @@ -66,8 +63,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; @@ -81,9 +83,16 @@ int Chktex::scanLogFile(TeXErrors & terr) token = split(token, warno, ':'); token = split(token, warning, ':'); - int lineno = lyx::atoi(line); - warno = _("ChkTeX warning id #") + warno; - terr.insertError(lineno, warno, warning); + int const lineno = lyx::atoi(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;