*** empty log message ***

This commit is contained in:
David Rose 2000-11-15 00:10:21 +00:00
parent da87ad16d7
commit 3a019ffeac
3 changed files with 46 additions and 2 deletions

View File

@ -11,6 +11,27 @@
#include <assert.h>
#include <unistd.h>
#include <sys/stat.h>
#include <algorithm>
class SortDependableFilesByName {
public:
bool operator () (PPDependableFile *a, PPDependableFile *b) const {
return a->get_filename() < b->get_filename();
}
};
////////////////////////////////////////////////////////////////////
// Function: PPDependableFile::Ordering Operator
// Access: Public
// Description: We provide this function so we can sort the
// dependency list into a consistent ordering, so that
// the makefiles won't get randomly regenerated between
// different sessions.
////////////////////////////////////////////////////////////////////
bool PPDependableFile::Dependency::
operator < (const Dependency &other) const {
return _file->get_filename() < other._file->get_filename();
}
////////////////////////////////////////////////////////////////////
// Function: PPDependableFile::Constructor
@ -80,6 +101,7 @@ update_from_cache(const vector<string> &words) {
}
_flags |= F_from_cache;
sort(_dependencies.begin(), _dependencies.end());
}
}
@ -204,6 +226,24 @@ get_dependency(int n) {
return _dependencies[n]._file;
}
////////////////////////////////////////////////////////////////////
// Function: PPDependableFile::get_complete_dependencies
// Access: Public
// Description: This flavor of get_complete_dependencies() works like
// the one below, except it returns the results in a
// consistently-ordered vector. This allows us to keep
// the dependencies in the same order between sessions
// and prevent makefiles from being arbitrarily
// regenerated.
////////////////////////////////////////////////////////////////////
void PPDependableFile::
get_complete_dependencies(vector<PPDependableFile *> &files) {
set<PPDependableFile *> files_set;
copy(files_set.begin(), files_set.end(), back_inserter(files));
sort(files.begin(), files.end(), SortDependableFilesByName());
}
////////////////////////////////////////////////////////////////////
// Function: PPDependableFile::get_complete_dependencies
// Access: Public
@ -377,6 +417,7 @@ compute_dependencies(string &circularity) {
}
_flags = (_flags & ~F_updating) | F_updated;
sort(_dependencies.begin(), _dependencies.end());
return circ;
}

View File

@ -39,6 +39,7 @@ public:
int get_num_dependencies();
PPDependableFile *get_dependency(int n);
void get_complete_dependencies(vector<PPDependableFile *> &files);
void get_complete_dependencies(set<PPDependableFile *> &files);
bool is_circularity();
@ -70,6 +71,8 @@ private:
public:
PPDependableFile *_file;
bool _okcircular;
bool operator < (const Dependency &other) const;
};
typedef vector<Dependency> Dependencies;

View File

@ -2709,10 +2709,10 @@ expand_dependencies(const string &params) {
PPDependableFile *file = _directory->get_dependable_file(*fi, false);
assert(file != (PPDependableFile *)NULL);
set<PPDependableFile *> files;
vector<PPDependableFile *> files;
file->get_complete_dependencies(files);
set<PPDependableFile *>::const_iterator dfi;
vector<PPDependableFile *>::const_iterator dfi;
for (dfi = files.begin(); dfi != files.end(); ++dfi) {
PPDependableFile *df = (*dfi);
string rel_filename =