From 792878af911bd1913706a1a8ee5a18f7230352ef Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 13 Jan 2007 14:48:41 +0000 Subject: [PATCH] * Make printing an expression as XML interruptible. --- src/libexpr/eval.cc | 4 ++++ src/libexpr/expr-to-xml.cc | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 8665edcfa..e6ea73efc 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -684,6 +684,9 @@ Expr strictEvalExpr(EvalState & state, Expr e, bool canonicalise) if (!matchBind(*i, name, e, pos)) abort(); /* can't happen */ as2 = ATinsert(as2, makeBind(name, strictEvalExpr(state, e, canonicalise), canonicalise ? makeNoPos() : pos)); + } + if (canonicalise) { + } /* !!! sort attributes if canonicalise == true */ return makeAttrs(ATreverse(as2)); @@ -716,6 +719,7 @@ Expr strictEvalExpr(EvalState & state, Expr e, bool canonicalise) formals2 = ATinsert(formals2, makeFormal(name, valids, dummy)); } + return makeFunction(ATreverse(formals2), body, canonicalise ? makeNoPos() : pos); } diff --git a/src/libexpr/expr-to-xml.cc b/src/libexpr/expr-to-xml.cc index 5c5b81b23..1a7302df1 100644 --- a/src/libexpr/expr-to-xml.cc +++ b/src/libexpr/expr-to-xml.cc @@ -2,6 +2,7 @@ #include "xml-writer.hh" #include "nixexpr-ast.hh" #include "aterm.hh" +#include "util.hh" namespace nix { @@ -24,6 +25,8 @@ static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context) ATermList as, es, formals; ATerm body, pos; + checkInterrupt(); + if (matchStr(e, s, context)) /* !!! show the context? */ doc.writeEmptyElement("string", singletonAttrs("value", s));