aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2010-03-30 09:22:33 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2010-03-30 09:22:33 +0000
commitd78a05ab4014d75fd1e394961376f02cff20ed88 (patch)
tree69aa8ef7d829b11bd5ff9c8aa6558b23cb95143b /src/libexpr/primops.cc
parent31428c3a0675f7223470af726bc697dc7a228927 (diff)
* Make `import' work.
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r--src/libexpr/primops.cc23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index a24f40be6..2815567e5 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -14,6 +14,7 @@
#include <unistd.h>
#include <algorithm>
+#include <cstring>
namespace nix {
@@ -69,20 +70,11 @@ static Expr prim_null(EvalState & state, const ATermVector & args)
}
-/* Return a string constant representing the current platform. Note!
- that differs between platforms, so Nix expressions using
- `__currentSystem' can evaluate to different values on different
- platforms. */
-static Expr prim_currentSystem(EvalState & state, const ATermVector & args)
-{
- return makeStr(thisSystem);
-}
-
-
static Expr prim_currentTime(EvalState & state, const ATermVector & args)
{
return ATmake("Int(<int>)", time(0));
}
+#endif
/*************************************************************
@@ -92,10 +84,10 @@ static Expr prim_currentTime(EvalState & state, const ATermVector & args)
/* Load and evaluate an expression from path specified by the
argument. */
-static Expr prim_import(EvalState & state, const ATermVector & args)
+static void prim_import(EvalState & state, Value * * args, Value & v)
{
PathSet context;
- Path path = coerceToPath(state, args[0], context);
+ Path path = state.coerceToPath(*args[0], context);
for (PathSet::iterator i = context.begin(); i != context.end(); ++i) {
assert(isStorePath(*i));
@@ -106,10 +98,11 @@ static Expr prim_import(EvalState & state, const ATermVector & args)
store->buildDerivations(singleton<PathSet>(*i));
}
- return evalFile(state, path);
+ state.evalFile(path, v);
}
+#if 0
/* Determine whether the argument is the null value. */
static Expr prim_isNull(EvalState & state, const ATermVector & args)
{
@@ -1134,7 +1127,7 @@ void EvalState::createBaseEnv()
v.type = tNull;
}
{ Value & v = (*baseEnv.bindings[toATerm("builtins")].attrs)[toATerm("currentSystem")];
- mkString(v, thisSystem.c_str()); // !!! copy string
+ mkString(v, strdup(thisSystem.c_str()));
}
#if 0
@@ -1143,7 +1136,9 @@ void EvalState::createBaseEnv()
addPrimOp("__currentTime", 0, prim_currentTime);
// Miscellaneous
+#endif
addPrimOp("import", 1, prim_import);
+#if 0
addPrimOp("isNull", 1, prim_isNull);
addPrimOp("__isFunction", 1, prim_isFunction);
addPrimOp("__isString", 1, prim_isString);