mirror of
https://github.com/NixOS/nix
synced 2025-07-07 01:51:47 +02:00
C API: fix docs build after rebase
This commit is contained in:
parent
92dacec0e4
commit
24604d024a
7 changed files with 23 additions and 18 deletions
|
@ -48,7 +48,7 @@ int main() {
|
|||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
**Usage:**
|
||||
```ShellSession
|
||||
$ gcc main.c $(pkg-config nix-expr-c --libs --cflags) -o main
|
||||
|
@ -66,7 +66,7 @@ It will increment the argument if it is an integer and throw an error otherwise.
|
|||
#include <nix_api_util.h>
|
||||
#include <nix_api_expr.h>
|
||||
#include <nix_api_value.h>
|
||||
|
||||
|
||||
void increment(void* user_data, nix_c_context* ctx, State* state, Value** args, Value* v) {
|
||||
nix_value_force(NULL, state, args[0]);
|
||||
if (nix_get_type(NULL, args[0]) == NIX_TYPE_INT) {
|
||||
|
@ -75,7 +75,7 @@ void increment(void* user_data, nix_c_context* ctx, State* state, Value** args,
|
|||
nix_set_err_msg(ctx, NIX_ERR_UNKNOWN, "First argument should be an integer.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void nix_plugin_entry() {
|
||||
const char* args[] = {"n", NULL};
|
||||
PrimOp *p = nix_alloc_primop(NULL, increment, 1, "increment", args, "Example custom built-in function: increments an integer", NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue