Nix 2.17.0
Nix, the purely functional package manager; stable external interfaces
Loading...
Searching...
No Matches
nix_api_value.h File Reference

libexpr C bindings dealing with values More...

#include "nix_api_util.h"
#include "stdbool.h"
#include "stddef.h"
#include "stdint.h"

Go to the source code of this file.

Typedefs

typedef void Value
 
typedef struct State State
 
typedef struct BindingsBuilder BindingsBuilder
 Stores an under-construction set of bindings. More...
 
typedef struct PrimOp PrimOp
 PrimOp function. More...
 
typedef struct ExternalValue ExternalValue
 External Value. More...
 
typedef void(* PrimOpFun) (State *state, int pos, Value **args, Value *v)
 Function pointer for primops. More...
 

Enumerations

enum  ValueType {
  NIX_TYPE_THUNK , NIX_TYPE_INT , NIX_TYPE_FLOAT , NIX_TYPE_BOOL ,
  NIX_TYPE_STRING , NIX_TYPE_PATH , NIX_TYPE_NULL , NIX_TYPE_ATTRS ,
  NIX_TYPE_LIST , NIX_TYPE_FUNCTION , NIX_TYPE_EXTERNAL
}
 

Functions

PrimOpnix_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...
 
Valuenix_alloc_value (nix_c_context *context, State *state)
 Allocate a Nix value. More...
 
BindingsBuildernix_make_bindings_builder (nix_c_context *context, State *state, size_t capacity)
 Create a bindings builder. More...
 
nix_err nix_bindings_builder_insert (nix_c_context *context, BindingsBuilder *builder, const char *name, Value *value)
 Insert bindings into a builder. More...
 
void nix_bindings_builder_free (BindingsBuilder *builder)
 Free a bindings builder. More...
 
Getters
ValueType nix_get_type (nix_c_context *context, const Value *value)
 Get value type. More...
 
const char * nix_get_typename (nix_c_context *context, const Value *value)
 Get type name of value. More...
 
bool nix_get_bool (nix_c_context *context, const Value *value)
 Get boolean value. More...
 
const char * nix_get_string (nix_c_context *context, const Value *value)
 Get string. More...
 
const char * nix_get_path_string (nix_c_context *context, const Value *value)
 Get path as string. More...
 
unsigned int nix_get_list_size (nix_c_context *context, const Value *value)
 Get the length of a list. More...
 
unsigned int nix_get_attrs_size (nix_c_context *context, const Value *value)
 Get the element count of an attrset. More...
 
double nix_get_float (nix_c_context *context, const Value *value)
 Get float value in 64 bits. More...
 
int64_t nix_get_int (nix_c_context *context, const Value *value)
 Get int value. More...
 
ExternalValuenix_get_external (nix_c_context *context, Value *)
 Get external reference. More...
 
Valuenix_get_list_byidx (nix_c_context *context, const Value *value, State *state, unsigned int ix)
 Get the ix'th element of a list. More...
 
Valuenix_get_attr_byname (nix_c_context *context, const Value *value, State *state, const char *name)
 Get an attr by name. More...
 
bool nix_has_attr_byname (nix_c_context *context, const Value *value, State *state, const char *name)
 Check if an attribute name exists on a value. More...
 
Valuenix_get_attr_byidx (nix_c_context *context, const Value *value, State *state, unsigned int i, const char **name)
 Get an attribute by index in the sorted bindings. More...
 
const char * nix_get_attr_name_byidx (nix_c_context *context, const Value *value, State *state, unsigned int i)
 Get an attribute name by index in the sorted bindings. More...
 
Setters
nix_err nix_set_bool (nix_c_context *context, Value *value, bool b)
 Set boolean value. More...
 
nix_err nix_set_string (nix_c_context *context, Value *value, const char *str)
 Set a string. More...
 
nix_err nix_set_path_string (nix_c_context *context, Value *value, const char *str)
 Set a path. More...
 
nix_err nix_set_float (nix_c_context *context, Value *value, double d)
 Set a float. More...
 
nix_err nix_set_int (nix_c_context *context, Value *value, int64_t i)
 Set an int. More...
 
nix_err nix_set_null (nix_c_context *context, Value *value)
 Set null. More...
 
nix_err nix_set_external (nix_c_context *context, Value *value, ExternalValue *val)
 Set an external value. More...
 
nix_err nix_make_list (nix_c_context *context, State *s, Value *value, unsigned int size)
 Allocate a list. More...
 
nix_err nix_set_list_byidx (nix_c_context *context, Value *value, unsigned int ix, Value *elem)
 Manipulate a list by index. More...
 
nix_err nix_make_attrs (nix_c_context *context, Value *value, BindingsBuilder *b)
 Create an attribute set from a bindings builder. More...
 
nix_err nix_set_primop (nix_c_context *context, Value *value, PrimOp *op)
 Set primop. More...
 
nix_err nix_copy_value (nix_c_context *context, Value *value, Value *source)
 Copy from another value. More...
 

Detailed Description

libexpr C bindings dealing with values