- if (lyxerr.debugging()) {
- char tmp1[256];
- char tmp2[256];
- sprintf(tmp1, "%lu", new_sum);
- sprintf(tmp2, "%lu", old_sum);
- lyxerr.debug("New file inserted in deplog: " +
- file + " " +
- tmp1 + " " + tmp2);
+}
+
+
+void DepTable::update()
+{
+ lyxerr[Debug::DEPEND] << "Updating DepTable..." << endl;
+ time_type const start_time = current_time();
+
+ DepList::iterator itr = deplist.begin();
+ while (itr != deplist.end()) {
+ dep_info &di = itr->second;
+
+ struct stat f_info;
+ if (stat(itr->first.c_str(), &f_info) == 0) {
+ if (di.mtime_cur == f_info.st_mtime) {
+ di.crc_prev = di.crc_cur;
+ lyxerr[Debug::DEPEND] << itr->first << " same mtime" << endl;
+ } else {
+ di.crc_prev = di.crc_cur;
+ lyxerr[Debug::DEPEND] << itr->first << " CRC... " << flush;
+ di.crc_cur = sum(itr->first);
+ lyxerr[Debug::DEPEND] << "done" << endl;
+ }
+ } else {
+ // file doesn't exist
+ // remove stale files - if it's re-created, it
+ // will be re-inserted by deplog.
+ lyxerr[Debug::DEPEND] << itr->first
+ << " doesn't exist. removing from DepTable." << endl;
+ DepList::iterator doomed = itr++;
+ deplist.erase(doomed);
+ continue;
+ }
+
+ if (lyxerr.debugging(Debug::DEPEND)) {
+ if (di.changed())
+ lyxerr << " +";
+ lyxerr << endl;
+ }
+ ++itr;