From ac68840e79ce74f05ee8b31bb1d528c98b9c7f76 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 19 Nov 2003 11:35:41 +0000 Subject: * Refactoring: put the Nix expression evaluator in its own library so that it can be used by multiple programs. --- src/libexpr/primops.hh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/libexpr/primops.hh (limited to 'src/libexpr/primops.hh') diff --git a/src/libexpr/primops.hh b/src/libexpr/primops.hh new file mode 100644 index 000000000000..76d587afdb1e --- /dev/null +++ b/src/libexpr/primops.hh @@ -0,0 +1,34 @@ +#ifndef __PRIMOPS_H +#define __PRIMOPS_H + +#include "eval.hh" + + +/* Load and evaluate an expression from path specified by the + argument. */ +Expr primImport(EvalState & state, Expr arg); + +/* Construct (as a unobservable) side effect) a Nix derivation + expression that performs the derivation described by the argument + set. Returns the original set extended with the following + attributes: `outPath' containing the primary output path of the + derivation; `drvPath' containing the path of the Nix expression; + and `type' set to `derivation' to indicate that this is a + derivation. */ +Expr primDerivation(EvalState & state, Expr args); + +/* Return the base name of the given string, i.e., everything + following the last slash. */ +Expr primBaseNameOf(EvalState & state, Expr arg); + +/* Convert the argument (which can be a path or a uri) to a string. */ +Expr primToString(EvalState & state, Expr arg); + +/* Return the null value. */ +Expr primNull(EvalState & state); + +/* Determine whether the argument is the null value. */ +Expr primIsNull(EvalState & state, Expr arg); + + +#endif /* !__PRIMOPS_H */ -- cgit 1.4.1