]> git.lyx.org Git - lyx.git/blobdiff - src/LaTeX.C
small changes to ButtonController usage
[lyx.git] / src / LaTeX.C
index 70510fff61cf246430f3496f4563f688858f1a4c..94af204a5f11d513789b36061ec6428f5b2b47cf 100644 (file)
@@ -51,29 +51,6 @@ using std::endl;
 
 extern BufferList bufferlist;
 
-struct texfile_struct {
-       LaTeX::TEX_FILES file;
-       char const * extension;
-};
-
-static
-const texfile_struct all_files[] = {
-       { LaTeX::AUX, ".aux"},
-       { LaTeX::BBL, ".bbl"},
-       { LaTeX::DVI, ".dvi"},
-       { LaTeX::GLO, ".glo"},
-       { LaTeX::IDX, ".idx"},
-       { LaTeX::IND, ".ind"},
-       { LaTeX::LOF, ".lof"},
-       { LaTeX::LOA, ".loa"},
-       { LaTeX::LOG, ".log"},
-       { LaTeX::LOT, ".lot"},
-       { LaTeX::TOC, ".toc"},
-       { LaTeX::LTX, ".ltx"},
-       { LaTeX::TEX, ".tex"}
-};
-
-
 /*
  * CLASS TEXERRORS
  */
@@ -92,8 +69,6 @@ void TeXErrors::insertError(int line, string const & error_desc,
 LaTeX::LaTeX(string const & latex, string const & f, string const & p)
                : cmd(latex), file(f), path(p)
 {
-       tex_files = NO_FILES;
-       file_count = sizeof(all_files) / sizeof(texfile_struct);
        num_errors = 0;
        depfile = file + ".dep";
 }
@@ -213,7 +188,6 @@ int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
 
        // update the dependencies.
        deplog(head); // reads the latex log
-       deptex(head); // checks for latex files
        head.update();
 
        // 0.5
@@ -622,7 +596,10 @@ void LaTeX::deplog(DepTable & head)
 
        LRegex reg1(")* *\\(([^ ]+).*");
        LRegex reg2("File: ([^ ]+).*");
-
+       LRegex reg3("No file ([^ ]+)\\..*");
+       LRegex reg4("\\\\openout[0-9]+.*=.*`([^ ]+)'\\..*");
+       LRegex unwanted("^.*\\.(aux|log|dvi|bbl|ind|glo)$");
+       
        ifstream ifs(logfile.c_str());
        while (ifs) {
                // Ok, the scanning of files here is not sufficient.
@@ -643,12 +620,20 @@ void LaTeX::deplog(DepTable & head)
                        LRegex::SubMatches const & sub = reg2.exec(token);
                        foundfile = LSubstring(token, sub[1].first,
                                               sub[1].second);
+               } else if (reg3.exact_match(token)) {
+                       LRegex::SubMatches const & sub = reg3.exec(token);
+                       foundfile = LSubstring(token, sub[1].first,
+                                              sub[1].second);
+               } else if (reg4.exact_match(token)) {
+                       LRegex::SubMatches const & sub = reg4.exec(token);
+                       foundfile = LSubstring(token, sub[1].first,
+                                              sub[1].second);
                } else {
                        continue;
                }
 
                lyxerr[Debug::DEPEND] << "Found file: " 
-                                    << foundfile << endl;
+                                     << foundfile << endl;
                
                // Ok now we found a file.
                // Now we should make sure that this is a file that we can
@@ -672,23 +657,26 @@ void LaTeX::deplog(DepTable & head)
                // (2) foundfile is in the tmpdir
                //     insert it into head
                if (FileInfo(OnlyFilename(foundfile)).exist()) {
-                       if (suffixIs(foundfile, ".aux")) {
-                               lyxerr[Debug::DEPEND] << "We don't want "
-                                                    << OnlyFilename(foundfile)
-                                                    << " in the dep file"
-                                                    << endl;
+                       if (unwanted.exact_match(foundfile)) {
+                               lyxerr[Debug::DEPEND]
+                                       << "We don't want "
+                                       << OnlyFilename(foundfile)
+                                       << " in the dep file"
+                                       << endl;
                        } else if (suffixIs(foundfile, ".tex")) {
                                // This is a tex file generated by LyX
                                // and latex is not likely to change this
                                // during its runs.
-                               lyxerr[Debug::DEPEND] << "Tmpdir TeX file: "
-                                                    << OnlyFilename(foundfile)
-                                                    << endl;
+                               lyxerr[Debug::DEPEND]
+                                       << "Tmpdir TeX file: "
+                                       << OnlyFilename(foundfile)
+                                       << endl;
                                head.insert(foundfile, true);
                        } else {
-                               lyxerr[Debug::DEPEND] << "In tmpdir file:"
-                                                    << OnlyFilename(foundfile)
-                                                    << endl;
+                               lyxerr[Debug::DEPEND]
+                                       << "In tmpdir file:"
+                                       << OnlyFilename(foundfile)
+                                       << endl;
                                head.insert(OnlyFilename(foundfile));
                        }
                        continue;
@@ -698,20 +686,3 @@ void LaTeX::deplog(DepTable & head)
                        << endl;
        }
 }
-
-
-void LaTeX::deptex(DepTable & head)
-{
-       int except = AUX|LOG|DVI|BBL|IND|GLO; 
-       string tmp;
-       FileInfo fi;
-       for (int i = 0; i < file_count; ++i) {
-               if (!(all_files[i].file & except)) {
-                       tmp = OnlyFilename(ChangeExtension(file,
-                                                          all_files[i].extension));
-                       lyxerr[Debug::DEPEND] << "deptex: " << tmp << endl;
-                       if (fi.newFile(tmp).exist())
-                               head.insert(tmp);
-               }
-       }
-}