* Nicer dot graphs.

This commit is contained in:
Eelco Dolstra 2003-07-29 10:53:27 +00:00
parent 79ba0431db
commit dc14a3de46
1 changed files with 7 additions and 1 deletions

View File

@ -185,7 +185,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
FState fs = parseFState(termFromId(id)); FState fs = parseFState(termFromId(id));
string label; string label, shape;
if (fs.type == FState::fsDerive) { if (fs.type == FState::fsDerive) {
for (FSIds::iterator i = fs.derive.inputs.begin(); for (FSIds::iterator i = fs.derive.inputs.begin();
@ -197,6 +197,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
} }
label = "derive"; label = "derive";
shape = "box";
for (StringPairs::iterator i = fs.derive.env.begin(); for (StringPairs::iterator i = fs.derive.env.begin();
i != fs.derive.env.end(); i++) i != fs.derive.env.end(); i++)
if (i->first == "name") label = i->second; if (i->first == "name") label = i->second;
@ -204,12 +205,17 @@ static void opQuery(Strings opFlags, Strings opArgs)
else if (fs.type == FState::fsSlice) { else if (fs.type == FState::fsSlice) {
label = baseNameOf((*fs.slice.elems.begin()).path); label = baseNameOf((*fs.slice.elems.begin()).path);
shape = "ellipse";
if (isHash(string(label, 0, Hash::hashSize * 2)) &&
label[Hash::hashSize * 2] == '-')
label = string(label, Hash::hashSize * 2 + 1);
} }
else abort(); else abort();
cout << dotQuote(id) << "[label = " cout << dotQuote(id) << "[label = "
<< dotQuote(label) << dotQuote(label)
<< ", shape = " << shape
<< "];\n"; << "];\n";
} }
} }