Make prim_exec and prim_importNative available to plugins
This commit is contained in:
parent
377cf43ff6
commit
fd98fca7bb
2 changed files with 10 additions and 2 deletions
|
@ -155,7 +155,7 @@ static void prim_scopedImport(EvalState & state, const Pos & pos, Value * * args
|
||||||
extern "C" typedef void (*ValueInitializer)(EvalState & state, Value & v);
|
extern "C" typedef void (*ValueInitializer)(EvalState & state, Value & v);
|
||||||
|
|
||||||
/* Load a ValueInitializer from a DSO and return whatever it initializes */
|
/* Load a ValueInitializer from a DSO and return whatever it initializes */
|
||||||
static void prim_importNative(EvalState & state, const Pos & pos, Value * * args, Value & v)
|
void prim_importNative(EvalState & state, const Pos & pos, Value * * args, Value & v)
|
||||||
{
|
{
|
||||||
PathSet context;
|
PathSet context;
|
||||||
Path path = state.coerceToPath(pos, *args[0], context);
|
Path path = state.coerceToPath(pos, *args[0], context);
|
||||||
|
@ -193,7 +193,7 @@ static void prim_importNative(EvalState & state, const Pos & pos, Value * * args
|
||||||
|
|
||||||
|
|
||||||
/* Execute a program and parse its output */
|
/* Execute a program and parse its output */
|
||||||
static void prim_exec(EvalState & state, const Pos & pos, Value * * args, Value & v)
|
void prim_exec(EvalState & state, const Pos & pos, Value * * args, Value & v)
|
||||||
{
|
{
|
||||||
state.forceList(*args[0], pos);
|
state.forceList(*args[0], pos);
|
||||||
auto elems = args[0]->listElems();
|
auto elems = args[0]->listElems();
|
||||||
|
|
|
@ -15,4 +15,12 @@ struct RegisterPrimOp
|
||||||
RegisterPrimOp(std::string name, size_t arity, PrimOpFun fun);
|
RegisterPrimOp(std::string name, size_t arity, PrimOpFun fun);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* These primops are disabled without enableNativeCode, but plugins
|
||||||
|
may wish to use them in limited contexts without globally enabling
|
||||||
|
them. */
|
||||||
|
/* Load a ValueInitializer from a DSO and return whatever it initializes */
|
||||||
|
void prim_importNative(EvalState & state, const Pos & pos, Value * * args, Value & v);
|
||||||
|
/* Execute a program and parse its output */
|
||||||
|
void prim_exec(EvalState & state, const Pos & pos, Value * * args, Value & v);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue