Nix 2.17.0
Nix, the purely functional package manager; stable external interfaces
Loading...
Searching...
No Matches
nix_api_external.h
Go to the documentation of this file.
1#ifndef NIX_API_EXTERNAL_H
2#define NIX_API_EXTERNAL_H
12#include "nix_api_expr.h"
13#include "nix_api_util.h"
14#include "nix_api_value.h"
15#include "stdbool.h"
16#include "stddef.h"
17#include "stdint.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22// cffi start
23
32typedef struct nix_printer nix_printer;
37
45void nix_set_string_return(nix_string_return *str, const char *c);
46
56 const char *str);
57
66 nix_string_context *string_context,
67 const char *c);
68
79typedef struct NixCExternalValueDesc {
86 void (*print)(void *self, nix_printer *printer);
92 void (*showType)(void *self, nix_string_return *res);
98 void (*typeOf)(void *self, nix_string_return *res);
113 void (*coerceToString)(void *self, nix_string_context *c, int coerceMore,
114 int copyToStore, nix_string_return *res);
126 int (*equal)(void *self, void *other);
140 void (*printValueAsJSON)(void *self, State *, int strict,
141 nix_string_context *c, bool copyToStore,
142 nix_string_return *res);
159 void (*printValueAsXML)(void *self, State *, int strict, int location,
160 void *doc, nix_string_context *c, void *drvsSeen,
161 int pos);
163
177 NixCExternalValueDesc *desc, void *v);
178
187
188// cffi end
189#ifdef __cplusplus
190}
191#endif
194#endif // NIX_API_EXTERNAL_H
nix_err nix_external_add_string_context(nix_c_context *context, nix_string_context *string_context, const char *c)
struct nix_string_return nix_string_return
Represents a string owned by nix.
Definition: nix_api_external.h:28
void nix_set_string_return(nix_string_return *str, const char *c)
Sets the contents of a nix_string_return.
struct nix_string_context nix_string_context
A list of string context items.
Definition: nix_api_external.h:36
ExternalValue * nix_create_external_value(nix_c_context *context, NixCExternalValueDesc *desc, void *v)
Create an external value, that can be given to nix_set_external.
nix_err nix_external_print(nix_c_context *context, nix_printer *printer, const char *str)
struct nix_printer nix_printer
Wraps a stream that can output multiple string pieces.
Definition: nix_api_external.h:32
void * nix_get_external_value_content(nix_c_context *context, ExternalValue *b)
Extract the pointer from a nix c external value.
struct ExternalValue ExternalValue
External Value.
Definition: nix_api_value.h:61
int nix_err
Type for error codes in the NIX system.
Definition: nix_api_util.h:59
Main entry for the libexpr C bindings.
Main entry for the libutil C bindings.
libexpr C bindings dealing with values
Definition for a class of external values.
Definition: nix_api_external.h:79
void(* print)(void *self, nix_printer *printer)
Called when printing the external value.
Definition: nix_api_external.h:86
int(* equal)(void *self, void *other)
Try to compare two external values.
Definition: nix_api_external.h:126
void(* showType)(void *self, nix_string_return *res)
Called on :t.
Definition: nix_api_external.h:92
void(* typeOf)(void *self, nix_string_return *res)
Called on builtins.typeOf
Definition: nix_api_external.h:98
void(* coerceToString)(void *self, nix_string_context *c, int coerceMore, int copyToStore, nix_string_return *res)
Called on "${str}" and builtins.toString.
Definition: nix_api_external.h:113
void(* printValueAsJSON)(void *self, State *, int strict, nix_string_context *c, bool copyToStore, nix_string_return *res)
Convert the external value to json.
Definition: nix_api_external.h:140
void(* printValueAsXML)(void *self, State *, int strict, int location, void *doc, nix_string_context *c, void *drvsSeen, int pos)
Convert the external value to XML.
Definition: nix_api_external.h:159
Represents a nix evaluator state.
This object stores error state.