X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLiterate.C;h=134d6d310e8876cf75e52b1b26e0a44019bdf92f;hb=35cf7dcb2bdfdcda465b69c58465f657c77fd9d7;hp=010dc0914d9e3a7d0e1744234d8f1010cf51997c;hpb=65b49997597efd5a5ba920c739ba6cd8384e1eeb;p=lyx.git diff --git a/src/Literate.C b/src/Literate.C index 010dc0914d..134d6d310e 100644 --- a/src/Literate.C +++ b/src/Literate.C @@ -3,7 +3,7 @@ * * LyX, The Document Processor * Copyright 1995 Matthias Ettrich - * Copyright 1995-1999 The LyX Team. + * Copyright 1995-2000 The LyX Team. * * ====================================================== */ @@ -29,6 +29,8 @@ #include "gettext.h" using std::ifstream; +using std::getline; +using std::endl; extern BufferList bufferlist; @@ -49,6 +51,7 @@ int Literate::weave(TeXErrors & terr, MiniBuffer * minib) string tmp1, tmp2; int ret1, ret2; Systemcalls one, two; + string logfile = OnlyFilename(ChangeExtension(file, ".log")); // The class LaTeX does not know the temp path. bufferlist.updateIncludedTeXfiles(GetCWD()); @@ -60,11 +63,12 @@ int Literate::weave(TeXErrors & terr, MiniBuffer * minib) // Run the literate program to convert \literate_extension file to .tex file // tmp1 = literate_cmd + " < " + litfile + " > " + file + " 2> " + litfile + ".out"; - tmp2 = literate_filter + " < " + litfile + ".out" + " > " + litfile + ".log"; + tmp2 = literate_filter + " < " + litfile + ".out" + " > " + logfile; ret1 = one.startscript(Systemcalls::System, tmp1); ret2 = two.startscript(Systemcalls::System, tmp2); lyxerr.debug() << "LITERATE {" << tmp1 << "} {" << tmp2 << "}" << endl; - scanres = scanLiterateLogFile(); + + scanres = scanLogFile(terr); if (scanres & Literate::ERRORS) return scanres; // return on literate error return run(terr, minib); } @@ -79,6 +83,8 @@ int Literate::build(TeXErrors & terr, MiniBuffer * minib) string tmp1, tmp2; int ret1, ret2; Systemcalls one, two; + string logfile = OnlyFilename(ChangeExtension(file, ".log")); + // The class LaTeX does not know the temp path. bufferlist.updateIncludedTeXfiles(GetCWD()); @@ -90,69 +96,12 @@ int Literate::build(TeXErrors & terr, MiniBuffer * minib) // Run the build program // tmp1 = build_cmd + ' ' + litfile + " > " + litfile + ".out 2>&1"; - tmp2 = build_filter + " < " + litfile + ".out" + " > " + litfile + ".log"; + tmp2 = build_filter + " < " + litfile + ".out" + " > " + logfile; ret1 = one.startscript(Systemcalls::System, tmp1); ret2 = two.startscript(Systemcalls::System, tmp2); - scanres = scanBuildLogFile(); + + scanres = scanLogFile(terr); lyxerr[Debug::LATEX] << "Done." << endl; return scanres; } - - -int Literate::scanLiterateLogFile() -{ - string token; - int retval = NO_ERRORS; - - string tmp = litfile + ".log"; - - ifstream ifs(tmp.c_str()); - while (getline(ifs, token)) { - lyxerr[Debug::LATEX] << token << endl; - - if (prefixIs(token, "Build Warning:")) { - // Here shall we handle different - // types of warnings - retval |= LATEX_WARNING; - lyxerr[Debug::LATEX] << "Build Warning." << endl; - } else if (prefixIs(token, "! Build Error:")) { - // Here shall we handle different - // types of errors - retval |= LATEX_ERROR; - lyxerr[Debug::LATEX] << "Build Error." << endl; - // this is not correct yet - num_errors++; - } - } - return retval; -} - - -int Literate::scanBuildLogFile() -{ - string token; - int retval = NO_ERRORS; - - string tmp = litfile + ".log"; - - ifstream ifs(tmp.c_str()); - while (getline(ifs, token)) { - lyxerr[Debug::LATEX] << token << endl; - - if (prefixIs(token, "Build Warning:")) { - // Here shall we handle different - // types of warnings - retval |= LATEX_WARNING; - lyxerr[Debug::LATEX] << "Build Warning." << endl; - } else if (prefixIs(token, "! Build Error:")) { - // Here shall we handle different - // types of errors - retval |= LATEX_ERROR; - lyxerr[Debug::LATEX] << "Build Error." << endl; - // this is not correct yet - num_errors++; - } - } - return retval; -}