2023-02-04 03:42:36 +00:00
|
|
|
#pragma once
|
2023-04-01 03:18:41 +00:00
|
|
|
///@file
|
2023-02-04 03:42:36 +00:00
|
|
|
|
|
|
|
#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;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|