diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-18 11:22:29 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2003-11-18 11:22:29 +0000 |
commit | ce92d1bf1434562f5b80320c503768c4d06f1f8d (patch) | |
tree | 477c80de94f3c403115f80bad450003946af2889 /src/fix-ng | |
parent | 9f0f020929c9e093405cc6193d2f227cab763912 (diff) |
* "Nix expression" -> "store expression".
* More refactoring.
Diffstat (limited to 'src/fix-ng')
-rw-r--r-- | src/fix-ng/Makefile.am | 2 | ||||
-rw-r--r-- | src/fix-ng/eval.cc | 1 | ||||
-rw-r--r-- | src/fix-ng/eval.hh | 5 | ||||
-rw-r--r-- | src/fix-ng/fix.cc | 1 | ||||
-rw-r--r-- | src/fix-ng/fixexpr.cc (renamed from src/fix-ng/fix-expr.cc) | 4 | ||||
-rw-r--r-- | src/fix-ng/fixexpr.hh (renamed from src/fix-ng/fix-expr.hh) | 0 | ||||
-rw-r--r-- | src/fix-ng/parser.cc | 4 | ||||
-rw-r--r-- | src/fix-ng/parser.hh | 2 | ||||
-rw-r--r-- | src/fix-ng/primops.cc | 28 |
9 files changed, 23 insertions, 24 deletions
diff --git a/src/fix-ng/Makefile.am b/src/fix-ng/Makefile.am index df3d17308..d30a5b2ea 100644 --- a/src/fix-ng/Makefile.am +++ b/src/fix-ng/Makefile.am @@ -1,6 +1,6 @@ bin_PROGRAMS = fix-ng -fix_ng_SOURCES = fix-expr.cc parser.cc eval.cc primops.cc fix.cc +fix_ng_SOURCES = fixexpr.cc parser.cc eval.cc primops.cc fix.cc fix_ng_LDADD = ../libmain/libmain.a ../libstore/libstore.a ../libutil/libutil.a \ ../boost/format/libformat.a -L../../externals/inst/lib -ldb_cxx \ -lsglr -lATB -lconversion -lasfix2 -lmept -lATerm diff --git a/src/fix-ng/eval.cc b/src/fix-ng/eval.cc index 57cca4c4a..b110c3a4a 100644 --- a/src/fix-ng/eval.cc +++ b/src/fix-ng/eval.cc @@ -1,5 +1,4 @@ #include "eval.hh" -#include "expr.hh" #include "parser.hh" #include "primops.hh" diff --git a/src/fix-ng/eval.hh b/src/fix-ng/eval.hh index 9be3ae2da..061c840a7 100644 --- a/src/fix-ng/eval.hh +++ b/src/fix-ng/eval.hh @@ -3,8 +3,9 @@ #include <map> -#include "fix-expr.hh" -#include "expr.hh" +#include "aterm.hh" +#include "hash.hh" +#include "fixexpr.hh" typedef map<Path, PathSet> DrvPaths; diff --git a/src/fix-ng/fix.cc b/src/fix-ng/fix.cc index 3b7dae38e..e407aaf44 100644 --- a/src/fix-ng/fix.cc +++ b/src/fix-ng/fix.cc @@ -4,7 +4,6 @@ #include "globals.hh" #include "normalise.hh" #include "shared.hh" -#include "expr.hh" #include "eval.hh" diff --git a/src/fix-ng/fix-expr.cc b/src/fix-ng/fixexpr.cc index e9c5a3ba6..721fa8afa 100644 --- a/src/fix-ng/fix-expr.cc +++ b/src/fix-ng/fixexpr.cc @@ -1,5 +1,5 @@ -#include "fix-expr.hh" -#include "expr.hh" +#include "fixexpr.hh" +#include "storeexpr.hh" ATermMap::ATermMap(unsigned int initialSize, unsigned int maxLoadPct) diff --git a/src/fix-ng/fix-expr.hh b/src/fix-ng/fixexpr.hh index 6c1e51d9c..6c1e51d9c 100644 --- a/src/fix-ng/fix-expr.hh +++ b/src/fix-ng/fixexpr.hh diff --git a/src/fix-ng/parser.cc b/src/fix-ng/parser.cc index 710ea6a86..eaa41b396 100644 --- a/src/fix-ng/parser.cc +++ b/src/fix-ng/parser.cc @@ -10,10 +10,10 @@ extern "C" { #include <asfix2.h> } +#include "aterm.hh" #include "parser.hh" #include "shared.hh" -#include "fix-expr.hh" -#include "expr.hh" +#include "fixexpr.hh" #include "parse-table.h" diff --git a/src/fix-ng/parser.hh b/src/fix-ng/parser.hh index c56a339a3..e44987dd0 100644 --- a/src/fix-ng/parser.hh +++ b/src/fix-ng/parser.hh @@ -1,7 +1,7 @@ #ifndef __PARSER_H #define __PARSER_H -#include "fix-expr.hh" +#include "fixexpr.hh" Expr parseExprFromFile(Path path); diff --git a/src/fix-ng/primops.cc b/src/fix-ng/primops.cc index 86b364c30..097933115 100644 --- a/src/fix-ng/primops.cc +++ b/src/fix-ng/primops.cc @@ -13,22 +13,22 @@ Expr primImport(EvalState & state, Expr arg) } -static PathSet nixExprRootsCached(EvalState & state, const Path & nePath) +static PathSet storeExprRootsCached(EvalState & state, const Path & nePath) { DrvPaths::iterator i = state.drvPaths.find(nePath); if (i != state.drvPaths.end()) return i->second; else { - PathSet paths = nixExprRoots(nePath); + PathSet paths = storeExprRoots(nePath); state.drvPaths[nePath] = paths; return paths; } } -static Hash hashDerivation(EvalState & state, NixExpr ne) +static Hash hashDerivation(EvalState & state, StoreExpr ne) { - if (ne.type == NixExpr::neDerivation) { + if (ne.type == StoreExpr::neDerivation) { PathSet inputs2; for (PathSet::iterator i = ne.derivation.inputs.begin(); i != ne.derivation.inputs.end(); i++) @@ -40,7 +40,7 @@ static Hash hashDerivation(EvalState & state, NixExpr ne) } ne.derivation.inputs = inputs2; } - return hashTerm(unparseNixExpr(ne)); + return hashTerm(unparseStoreExpr(ne)); } @@ -50,13 +50,13 @@ static Path copyAtom(EvalState & state, const Path & srcPath) Path dstPath(addToStore(srcPath)); ClosureElem elem; - NixExpr ne; - ne.type = NixExpr::neClosure; + StoreExpr ne; + ne.type = StoreExpr::neClosure; ne.closure.roots.insert(dstPath); ne.closure.elems[dstPath] = elem; Hash drvHash = hashDerivation(state, ne); - Path drvPath = writeTerm(unparseNixExpr(ne), ""); + Path drvPath = writeTerm(unparseStoreExpr(ne), ""); state.drvHashes[drvPath] = drvHash; printMsg(lvlChatty, format("copied `%1%' -> closure `%2%'") @@ -66,9 +66,9 @@ static Path copyAtom(EvalState & state, const Path & srcPath) static string addInput(EvalState & state, - Path & nePath, NixExpr & ne) + Path & nePath, StoreExpr & ne) { - PathSet paths = nixExprRootsCached(state, nePath); + PathSet paths = storeExprRootsCached(state, nePath); if (paths.size() != 1) abort(); Path path = *(paths.begin()); ne.derivation.inputs.insert(nePath); @@ -76,7 +76,7 @@ static string addInput(EvalState & state, } -static string processBinding(EvalState & state, Expr e, NixExpr & ne) +static string processBinding(EvalState & state, Expr e, StoreExpr & ne) { e = evalExpr(state, e); @@ -131,8 +131,8 @@ Expr primDerivation(EvalState & state, Expr args) queryAllAttrs(args, attrs); /* Build the derivation expression by processing the attributes. */ - NixExpr ne; - ne.type = NixExpr::neDerivation; + StoreExpr ne; + ne.type = StoreExpr::neDerivation; string drvName; Path outPath; @@ -198,7 +198,7 @@ Expr primDerivation(EvalState & state, Expr args) Hash drvHash = outHashGiven ? hashString((string) outHash + outPath) : hashDerivation(state, ne); - Path drvPath = writeTerm(unparseNixExpr(ne), "-d-" + drvName); + Path drvPath = writeTerm(unparseStoreExpr(ne), "-d-" + drvName); state.drvHashes[drvPath] = drvHash; printMsg(lvlChatty, format("instantiated `%1%' -> `%2%'") |