From 9a64454faae2ab4ccedeeaad85a0e094726b4765 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 7 Apr 2010 13:59:45 +0000 Subject: [PATCH] * expr-to-xml -> value-to-xml. --- src/libexpr/Makefile.am | 4 ++-- src/libexpr/primops.cc | 2 +- src/libexpr/{expr-to-xml.cc => value-to-xml.cc} | 2 +- src/libexpr/{expr-to-xml.hh => value-to-xml.hh} | 6 +++--- src/nix-instantiate/nix-instantiate.cc | 11 ++++++++--- 5 files changed, 15 insertions(+), 10 deletions(-) rename src/libexpr/{expr-to-xml.cc => value-to-xml.cc} (99%) rename src/libexpr/{expr-to-xml.hh => value-to-xml.hh} (72%) diff --git a/src/libexpr/Makefile.am b/src/libexpr/Makefile.am index c5f487769..99f742ffe 100644 --- a/src/libexpr/Makefile.am +++ b/src/libexpr/Makefile.am @@ -2,12 +2,12 @@ pkglib_LTLIBRARIES = libexpr.la libexpr_la_SOURCES = \ nixexpr.cc eval.cc primops.cc lexer-tab.cc parser-tab.cc \ - get-drvs.cc attr-path.cc expr-to-xml.cc common-opts.cc \ + get-drvs.cc attr-path.cc value-to-xml.cc common-opts.cc \ names.cc pkginclude_HEADERS = \ nixexpr.hh eval.hh parser.hh lexer-tab.hh parser-tab.hh \ - get-drvs.hh attr-path.hh expr-to-xml.hh common-opts.hh \ + get-drvs.hh attr-path.hh value-to-xml.hh common-opts.hh \ names.hh nixexpr-ast.hh libexpr_la_LIBADD = ../libutil/libutil.la ../libstore/libstore.la \ diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 5fa2418b5..74eb2b26d 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -4,7 +4,7 @@ #include "store-api.hh" #include "util.hh" #include "archive.hh" -#include "expr-to-xml.hh" +#include "value-to-xml.hh" #include "nixexpr-ast.hh" #include "parser.hh" #include "names.hh" diff --git a/src/libexpr/expr-to-xml.cc b/src/libexpr/value-to-xml.cc similarity index 99% rename from src/libexpr/expr-to-xml.cc rename to src/libexpr/value-to-xml.cc index ad68739c3..eff414aba 100644 --- a/src/libexpr/expr-to-xml.cc +++ b/src/libexpr/value-to-xml.cc @@ -1,4 +1,4 @@ -#include "expr-to-xml.hh" +#include "value-to-xml.hh" #include "xml-writer.hh" #include "nixexpr-ast.hh" #include "aterm.hh" diff --git a/src/libexpr/expr-to-xml.hh b/src/libexpr/value-to-xml.hh similarity index 72% rename from src/libexpr/expr-to-xml.hh rename to src/libexpr/value-to-xml.hh index 8f094185c..7dfbe06d1 100644 --- a/src/libexpr/expr-to-xml.hh +++ b/src/libexpr/value-to-xml.hh @@ -1,5 +1,5 @@ -#ifndef __EXPR_TO_XML_H -#define __EXPR_TO_XML_H +#ifndef __VALUE_TO_XML_H +#define __VALUE_TO_XML_H #include #include @@ -14,4 +14,4 @@ void printValueAsXML(EvalState & state, bool strict, } -#endif /* !__EXPR_TO_XML_H */ +#endif /* !__VALUE_TO_XML_H */ diff --git a/src/nix-instantiate/nix-instantiate.cc b/src/nix-instantiate/nix-instantiate.cc index 2f41fa81b..ebf1be5b9 100644 --- a/src/nix-instantiate/nix-instantiate.cc +++ b/src/nix-instantiate/nix-instantiate.cc @@ -7,7 +7,7 @@ #include "parser.hh" #include "get-drvs.hh" #include "attr-path.hh" -#include "expr-to-xml.hh" +#include "value-to-xml.hh" #include "util.hh" #include "store-api.hh" #include "common-opts.hh" @@ -75,10 +75,15 @@ void processExpr(EvalState & state, const Strings & attrPaths, std::cout << format("%1%\n") % canonicaliseExpr(e); else { Value v; + PathSet context; state.eval(e, v); - if (strict) state.strictForceValue(v); if (evalOnly) - std::cout << v << std::endl; + if (xmlOutput) + printValueAsXML(state, strict, v, std::cout, context); + else { + if (strict) state.strictForceValue(v); + std::cout << v << std::endl; + } else { DrvInfos drvs; getDerivations(state, v, "", autoArgs, drvs);