nix-super/src/libstore/expr.hh

61 lines
1 KiB
C++
Raw Normal View History

#ifndef __FSTATE_H
#define __FSTATE_H
#include "aterm.hh"
#include "store.hh"
/* Abstract syntax of Nix expressions. */
2003-06-27 12:55:31 +03:00
struct ClosureElem
{
PathSet refs;
};
typedef map<Path, ClosureElem> ClosureElems;
struct Closure
{
PathSet roots;
ClosureElems elems;
};
typedef map<string, string> StringPairs;
2003-07-20 22:29:38 +03:00
struct Derivation
2003-07-20 22:29:38 +03:00
{
PathSet outputs;
PathSet inputs; /* Nix expressions, not actual inputs */
2003-07-20 22:29:38 +03:00
string platform;
Path builder;
Strings args;
2003-07-20 22:29:38 +03:00
StringPairs env;
};
struct NixExpr
2003-07-20 22:29:38 +03:00
{
enum { neClosure, neDerivation } type;
Closure closure;
Derivation derivation;
2003-07-20 22:29:38 +03:00
};
2003-07-06 17:20:47 +03:00
/* Throw an exception with an error message containing the given
aterm. */
Error badTerm(const format & f, ATerm t);
/* Hash an aterm. */
Hash hashTerm(ATerm t);
/* Write an aterm to the Nix store directory, and return its path. */
Path writeTerm(ATerm t, const string & suffix);
/* Parse a Nix expression. */
NixExpr parseNixExpr(ATerm t);
2003-07-16 14:05:59 +03:00
/* Parse a Nix expression. */
ATerm unparseNixExpr(const NixExpr & ne);
2003-07-16 01:28:27 +03:00
#endif /* !__FSTATE_H */