+ string const f = MakeAbsPath(fi);
+ if (deplist.find(f) == deplist.end()) {
+ dep_info di;
+ di.crc_prev = 0;
+ if (upd) {
+ lyxerr[Debug::DEPEND] << " CRC..." << flush;
+ di.crc_cur = sum(f);
+ lyxerr[Debug::DEPEND] << "done." << endl;
+ struct stat f_info;
+ stat(fi.c_str(), &f_info);
+ di.mtime_cur = f_info.st_mtime;
+ } else {
+ di.crc_cur = 0;
+ di.mtime_cur = 0;
+ }
+ deplist[f] = di;
+ } else {
+ lyxerr[Debug::DEPEND] << " Already in DepTable" << endl;
+ }
+}
+
+
+void DepTable::update()
+{
+ lyxerr[Debug::DEPEND] << "Updating DepTable..." << endl;
+ lyx::time_type const start_time = lyx::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";
+ } else {
+ di.crc_prev = di.crc_cur;
+ lyxerr[Debug::DEPEND] << itr->first << " CRC... ";
+ di.crc_cur = sum(itr->first);
+ lyxerr[Debug::DEPEND] << "done";
+ }
+ } 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;