+2000-05-31 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * src/support/lyxstring.C (begin): fix a "shared" string bug. use
+ rep->get_own_copy()
+ (end): ditto
+
+ * src/LaTeX.C (deplog): better searching for dependency files in
+ the latex log. Uses now regexps.
+
+ * lib/layouts/stdlists.inc (lyxlist): fix the label to use \hfil
+ instead of the box hack or \hfill.
+
2000-05-31 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyxfunc.C (doImportHelper): do not create the file before
// dependency file.
string logfile = OnlyFilename(ChangeExtension(file, ".log"));
-
+
+ LRegex reg1(")* *\\(([^ ]+).*");
+ LRegex reg2("File: ([^ ]+).*");
+
ifstream ifs(logfile.c_str());
while (ifs) {
- // Now we read chars until we find a '('
- char c = 0;
- while(ifs.get(c)) {
- if (c == '(') break;
- };
- if (!ifs) break;
-
- // We now have c == '(', we now read the the sequence of
- // chars until reaching EOL, ' ' or ')' and put that
- // into a string.
+ // Ok, the scanning of files here is not sufficient.
+ // Sometimes files are named by "File: xxx" only
+ // So I think we should use some regexps to find files instead.
+ // "(\([^ ]+\)" should match the "(file " variant
+ // "File: \([^ ]+\)" should match the "File: file" variant
string foundfile;
- while (ifs.get(c)) {
- if (c == '\n' || c == ' ' || c == ')')
- break;
- foundfile += c;
+ string token;
+ getline(ifs, token);
+ if (token.empty()) continue;
+
+ if (reg1.exact_match(token)) {
+ LRegex::SubMatches const & sub = reg1.exec(token);
+ foundfile = LSubstring(token, sub[1].first,
+ sub[1].second);
+ } else if (reg2.exact_match(token)) {
+ LRegex::SubMatches const & sub = reg2.exec(token);
+ foundfile = LSubstring(token, sub[1].first,
+ sub[1].second);
+ } else {
+ continue;
}
+
lyxerr[Debug::DEPEND] << "Found file: "
<< foundfile << endl;
// Ok now we found a file.
- // Now we should make sure that
- // this is a file that we can
- // access through the normal
- // paths:
+ // Now we should make sure that this is a file that we can
+ // access through the normal paths.
+ // We will not try any fance search methods to
+ // find the file.
+
// (1) foundfile is an
// absolute path and should
// be inserted.
if (AbsolutePath(foundfile)) {
lyxerr[Debug::DEPEND] << "AbsolutePath file: "
- << foundfile << endl;
+ << foundfile << endl;
// On inital insert we want to do the update at once
// since this file can not be a file generated by
// the latex run.