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