diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-10-08T15·06+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-10-08T15·06+0000 |
commit | 6baa2c442035fb06652a7fad9d51df1ce41c05f9 (patch) | |
tree | c77e57b30ea01fd7ae76ca04a7d8bbc13a1a3979 /src/dotgraph.cc | |
parent | b9f4942bd2f8aae44db6caa5a4ebe5680880fec2 (diff) |
* Get rid of identifiers since they are redundant now. This greatly
simplifies stuff. * The format of Nix expressions and the database schema changed because of this, so it's best to delete old Nix installations.
Diffstat (limited to 'src/dotgraph.cc')
-rw-r--r-- | src/dotgraph.cc | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/dotgraph.cc b/src/dotgraph.cc index f9ff51b909c4..514fda325914 100644 --- a/src/dotgraph.cc +++ b/src/dotgraph.cc @@ -45,24 +45,24 @@ static string symbolicName(const string & path) } -string pathLabel(const FSId & id, const string & path) +string pathLabel(const Path & nePath, const string & elemPath) { - return (string) id + "-" + path; + return (string) nePath + "-" + elemPath; } -void printClosure(const FSId & id, const NixExpr & fs) +void printClosure(const Path & nePath, const NixExpr & fs) { - Strings workList(fs.closure.roots.begin(), fs.closure.roots.end()); - StringSet doneSet; + PathSet workList(fs.closure.roots); + PathSet doneSet; - for (Strings::iterator i = workList.begin(); i != workList.end(); i++) { - cout << makeEdge(pathLabel(id, *i), id); + for (PathSet::iterator i = workList.begin(); i != workList.end(); i++) { + cout << makeEdge(pathLabel(nePath, *i), nePath); } while (!workList.empty()) { - string path = workList.front(); - workList.pop_front(); + Path path = *(workList.begin()); + workList.erase(path); if (doneSet.find(path) == doneSet.end()) { doneSet.insert(path); @@ -74,41 +74,41 @@ void printClosure(const FSId & id, const NixExpr & fs) for (StringSet::const_iterator i = elem->second.refs.begin(); i != elem->second.refs.end(); i++) { - workList.push_back(*i); - cout << makeEdge(pathLabel(id, *i), pathLabel(id, path)); + workList.insert(*i); + cout << makeEdge(pathLabel(nePath, *i), pathLabel(nePath, path)); } - cout << makeNode(pathLabel(id, path), + cout << makeNode(pathLabel(nePath, path), symbolicName(path), "#ff0000"); } } } -void printDotGraph(const FSIds & roots) +void printDotGraph(const PathSet & roots) { - FSIds workList(roots.begin(), roots.end()); - FSIdSet doneSet; + PathSet workList(roots); + PathSet doneSet; cout << "digraph G {\n"; while (!workList.empty()) { - FSId id = workList.front(); - workList.pop_front(); + Path nePath = *(workList.begin()); + workList.erase(nePath); - if (doneSet.find(id) == doneSet.end()) { - doneSet.insert(id); + if (doneSet.find(nePath) == doneSet.end()) { + doneSet.insert(nePath); - NixExpr ne = parseNixExpr(termFromId(id)); + NixExpr ne = parseNixExpr(termFromPath(nePath)); string label, colour; if (ne.type == NixExpr::neDerivation) { - for (FSIdSet::iterator i = ne.derivation.inputs.begin(); + for (PathSet::iterator i = ne.derivation.inputs.begin(); i != ne.derivation.inputs.end(); i++) { - workList.push_back(*i); - cout << makeEdge(*i, id); + workList.insert(*i); + cout << makeEdge(*i, nePath); } label = "derivation"; @@ -121,12 +121,12 @@ void printDotGraph(const FSIds & roots) else if (ne.type == NixExpr::neClosure) { label = "<closure>"; colour = "#00ffff"; - printClosure(id, ne); + printClosure(nePath, ne); } else abort(); - cout << makeNode(id, label, colour); + cout << makeNode(nePath, label, colour); } } |