1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-20 11:11:03 -04:00
nix/src/fstate.hh

76 lines
1.3 KiB
C++
Raw Normal View History

#ifndef __FSTATE_H
#define __FSTATE_H
extern "C" {
#include <aterm2.h>
}
#include "store.hh"
2003-07-20 15:29:38 -04:00
/* Abstract syntax of fstate-expressions. */
2003-06-27 05:55:31 -04:00
typedef list<FSId> FSIds;
struct SliceElem
{
string path;
FSId id;
FSIds refs;
};
typedef list<SliceElem> SliceElems;
struct Slice
{
FSIds roots;
SliceElems elems;
};
2003-07-20 15:29:38 -04:00
typedef pair<string, FSId> DeriveOutput;
typedef pair<string, string> StringPair;
typedef list<DeriveOutput> DeriveOutputs;
typedef list<StringPair> StringPairs;
struct Derive
{
DeriveOutputs outputs;
FSIds inputs;
string builder;
string platform;
StringPairs env;
};
struct FState
{
enum { fsSlice, fsDerive } type;
Slice slice;
Derive derive;
};
2003-06-17 09:37:44 -04:00
/* Return a canonical textual representation of an expression. */
string printTerm(ATerm t);
2003-07-06 10:20:47 -04: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);
/* Read an aterm from disk, given its id. */
2003-07-20 15:29:38 -04:00
ATerm termFromId(const FSId & id);
2003-07-06 10:20:47 -04:00
/* Write an aterm to the Nix store directory, and return its hash. */
FSId writeTerm(ATerm t, const string & suffix, FSId id = FSId());
2003-07-20 15:29:38 -04:00
/* Parse an fstate-expression. */
FState parseFState(ATerm t);
2003-07-16 07:05:59 -04:00
2003-07-20 15:29:38 -04:00
/* Parse an fstate-expression. */
ATerm unparseFState(const FState & fs);
2003-07-15 18:28:27 -04:00
#endif /* !__FSTATE_H */