|
Nix 2.17.0
Nix, the purely functional package manager; stable external interfaces
|
Create your own primops. More...
Typedefs | |
| typedef struct PrimOp | PrimOp |
| PrimOp function. More... | |
| typedef void(* | PrimOpFun) (State *state, int pos, Value **args, Value *v) |
| Function pointer for primops. More... | |
Functions | |
| PrimOp * | nix_alloc_primop (nix_c_context *context, PrimOpFun fun, int arity, const char *name, const char **args, const char *doc) |
| Allocate a primop. More... | |
| nix_err | nix_register_primop (nix_c_context *context, PrimOp *primOp) |
| add a primop to builtins More... | |
Create your own primops.
Function pointer for primops.
| [in] | state | Evaluator state |
| [in] | pos | position of function call |
| [in] | args | list of arguments |
| [out] | v | return value |
| PrimOp * nix_alloc_primop | ( | nix_c_context * | context, |
| PrimOpFun | fun, | ||
| int | arity, | ||
| const char * | name, | ||
| const char ** | args, | ||
| const char * | doc | ||
| ) |
Allocate a primop.
Owned by the GC. Use nix_gc_decref when you're done with the pointer
| [out] | context | Optional, stores error information |
| [in] | fun | callback |
| [in] | arity | expected amount of function arguments |
| [in] | name | function name |
| [in] | args | array of argument names |
| [in] | doc | optional, documentation for this primop |
| nix_err nix_register_primop | ( | nix_c_context * | context, |
| PrimOp * | primOp | ||
| ) |
add a primop to builtins
Only applies to new States.
Moves your primop into the global registry, meaning your input primOp is no longer usable (but still possibly subject to garbage collection).
| [out] | context | Optional, stores error information |