aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/repl.hh
blob: 731c8e6db6054ef737edd41ae1afaad0403716cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once
///@file

#include "eval.hh"

#if HAVE_BOEHMGC
#define GC_INCLUDE_NEW
#include <gc/gc_cpp.h>
#endif

namespace nix {

struct AbstractNixRepl
{
    ref<EvalState> state;
    Bindings * autoArgs;

    AbstractNixRepl(ref<EvalState> state)
        : state(state)
    { }

    virtual ~AbstractNixRepl()
    { }

    typedef std::vector<std::pair<Value*,std::string>> AnnotatedValues;

    static std::unique_ptr<AbstractNixRepl> create(
        const Strings & searchPath, nix::ref<Store> store, ref<EvalState> state,
        std::function<AnnotatedValues()> getValues);

    static void runSimple(
        ref<EvalState> evalState,
        const ValMap & extraEnv);

    virtual void initEnv() = 0;

    virtual void mainLoop() = 0;
};

}