mirror of
https://github.com/NixOS/nix
synced 2025-06-30 03:23:16 +02:00
nix_api_value: Add nix_register_primop to add builtins
This commit is contained in:
parent
e891aac2e4
commit
713f10aeaa
2 changed files with 24 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "eval.hh"
|
||||
#include "gc/gc.h"
|
||||
#include "globals.hh"
|
||||
#include "primops.hh"
|
||||
#include "value.hh"
|
||||
|
||||
#include "nix_api_expr.h"
|
||||
|
@ -55,6 +56,15 @@ PrimOp *nix_alloc_primop(nix_c_context *context, PrimOpFun fun, int arity,
|
|||
NIXC_CATCH_ERRS_NULL
|
||||
}
|
||||
|
||||
nix_err nix_register_primop(nix_c_context *context, PrimOp *primOp) {
|
||||
if (context)
|
||||
context->last_err_code = NIX_OK;
|
||||
try {
|
||||
nix::RegisterPrimOp r(std::move(*((nix::PrimOp *)primOp)));
|
||||
}
|
||||
NIXC_CATCH_ERRS
|
||||
}
|
||||
|
||||
Value *nix_alloc_value(nix_c_context *context, State *state) {
|
||||
if (context)
|
||||
context->last_err_code = NIX_OK;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue