From 3f3c4cce5a6552016a040999f64dc989d203a9ef Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 18 Mar 2004 21:04:14 +0000 Subject: [PATCH] * Added an extra escape code to signal "unimportant" messages. If a tree only has unimportant messages, it is collapsed by the default. * Also added an optional integer argument to the escape code for opening a nesting level to indicate lack of importance. If set, the tree is collapsed by default. --- src/log2xml/log2html.xsl | 20 +++++++++++++++++--- src/log2xml/log2xml.cc | 29 ++++++++++++++++++++++++++--- src/log2xml/treebits.js | 6 +++--- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/log2xml/log2html.xsl b/src/log2xml/log2html.xsl index 667eb5998..f75b2eb86 100644 --- a/src/log2xml/log2html.xsl +++ b/src/log2xml/log2html.xsl @@ -24,11 +24,25 @@ - + + + + + display: none; + truefalse + + -
    + +
      - linelastline + + + linelastline +
    • diff --git a/src/log2xml/log2xml.cc b/src/log2xml/log2xml.cc index f3e976fd9..cf56374cb 100644 --- a/src/log2xml/log2xml.cc +++ b/src/log2xml/log2xml.cc @@ -1,3 +1,4 @@ +#include #include #include #include @@ -11,6 +12,9 @@ struct Decoder string line; bool inHeader; int level; + vector args; + bool newNumber; + int priority; Decoder() { @@ -18,6 +22,7 @@ struct Decoder line = ""; inHeader = false; level = 0; + priority = 1; } void pushChar(char c); @@ -39,9 +44,11 @@ void Decoder::pushChar(char c) break; case stEscape: - if (c == '[') + if (c == '[') { state = stCSI; - else + args.clear(); + newNumber = true; + } else state = stTop; /* !!! wrong */ break; @@ -54,6 +61,7 @@ void Decoder::pushChar(char c) level++; inHeader = true; cout << "" << endl; + priority = args.size() >= 1 ? args[0] : 1; break; case 'q': if (line.size()) finishLine(); @@ -63,7 +71,19 @@ void Decoder::pushChar(char c) } else cerr << "not enough nesting levels" << endl; break; + case 's': + if (line.size()) finishLine(); + priority = args.size() >= 1 ? args[0] : 1; + break; } + } else if (c >= '0' && c <= '9') { + int n = 0; + if (!newNumber) { + n = args.back() * 10; + args.pop_back(); + } + n += c - '0'; + args.push_back(n); } break; @@ -76,7 +96,9 @@ void Decoder::finishLine() string storeDir = "/nix/store/"; int sz = storeDir.size(); string tag = inHeader ? "head" : "line"; - cout << "<" << tag << ">"; + cout << "<" << tag; + if (priority != 1) cout << " priority='" << priority << "'"; + cout << ">"; for (int i = 0; i < line.size(); i++) { @@ -113,6 +135,7 @@ void Decoder::finishLine() cout << "" << endl; line = ""; inHeader = false; + priority = 1; } diff --git a/src/log2xml/treebits.js b/src/log2xml/treebits.js index ffd18fbb1..3011b391d 100644 --- a/src/log2xml/treebits.js +++ b/src/log2xml/treebits.js @@ -5,13 +5,13 @@ var idCounter = 0; -function showTreeToggle(show,hide) { +function showTreeToggle(isHidden) { if (document.getElementById) { var id = "toggle_" + idCounter; document.writeln( '' + - '' + - '-' + + '+' + + '-' + ''); idCounter = idCounter + 1; }