|
Nix 2.17.0
Nix, the purely functional package manager; stable external interfaces
|
Functions to inspect and change nix Value's. More...
Typedefs | |
| typedef struct BindingsBuilder | BindingsBuilder |
| Stores an under-construction set of bindings. More... | |
Functions | |
| BindingsBuilder * | nix_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... | |
| ExternalValue * | nix_get_external (nix_c_context *context, Value *) |
| Get external reference. More... | |
| Value * | nix_get_list_byidx (nix_c_context *context, const Value *value, State *state, unsigned int ix) |
| Get the ix'th element of a list. More... | |
| Value * | nix_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... | |
| Value * | nix_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... | |
Functions to inspect and change nix Value's.
| typedef struct BindingsBuilder BindingsBuilder |
Stores an under-construction set of bindings.
Do not reuse.
| void nix_bindings_builder_free | ( | BindingsBuilder * | builder | ) |
Free a bindings builder.
Does not fail.
| [in] | builder | the builder to free |
| nix_err nix_bindings_builder_insert | ( | nix_c_context * | context, |
| BindingsBuilder * | builder, | ||
| const char * | name, | ||
| Value * | value | ||
| ) |
Insert bindings into a builder.
| [out] | context | Optional, stores error information |
| [in] | builder | BindingsBuilder to insert into |
| [in] | name | attribute name, copied into the symbol store |
| [in] | value | value to give the binding |
| nix_err nix_copy_value | ( | nix_c_context * | context, |
| Value * | value, | ||
| Value * | source | ||
| ) |
Copy from another value.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | source | value to copy from |
| Value * nix_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.
Also gives you the name.
Owned by the GC. Use nix_gc_decref when you're done with the pointer
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| [in] | state | nix evaluator state |
| [in] | i | attribute index |
| [out] | name | will store a pointer to the attribute name |
| Value * nix_get_attr_byname | ( | nix_c_context * | context, |
| const Value * | value, | ||
| State * | state, | ||
| const char * | name | ||
| ) |
Get an attr by name.
Owned by the GC. Use nix_gc_decref when you're done with the pointer
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| [in] | state | nix evaluator state |
| [in] | name | attribute name |
| 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.
Useful when you want the name but want to avoid evaluation.
Owned by the nix State
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| [in] | state | nix evaluator state |
| [in] | i | attribute index |
| unsigned int nix_get_attrs_size | ( | nix_c_context * | context, |
| const Value * | value | ||
| ) |
Get the element count of an attrset.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| bool nix_get_bool | ( | nix_c_context * | context, |
| const Value * | value | ||
| ) |
Get boolean value.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| ExternalValue * nix_get_external | ( | nix_c_context * | context, |
| Value * | |||
| ) |
Get external reference.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| double nix_get_float | ( | nix_c_context * | context, |
| const Value * | value | ||
| ) |
Get float value in 64 bits.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| int64_t nix_get_int | ( | nix_c_context * | context, |
| const Value * | value | ||
| ) |
Get int value.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| Value * nix_get_list_byidx | ( | nix_c_context * | context, |
| const Value * | value, | ||
| State * | state, | ||
| unsigned int | ix | ||
| ) |
Get the ix'th element of a list.
Owned by the GC. Use nix_gc_decref when you're done with the pointer
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| [in] | state | nix evaluator state |
| [in] | ix | list element to get |
| unsigned int nix_get_list_size | ( | nix_c_context * | context, |
| const Value * | value | ||
| ) |
Get the length of a list.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| const char * nix_get_path_string | ( | nix_c_context * | context, |
| const Value * | value | ||
| ) |
Get path as string.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| const char * nix_get_string | ( | nix_c_context * | context, |
| const Value * | value | ||
| ) |
Get string.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| ValueType nix_get_type | ( | nix_c_context * | context, |
| const Value * | value | ||
| ) |
Get value type.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| const char * nix_get_typename | ( | nix_c_context * | context, |
| const Value * | value | ||
| ) |
Get type name of value.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| 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.
| [out] | context | Optional, stores error information |
| [in] | value | Nix value to inspect |
| [in] | state | nix evaluator state |
| [in] | name | attribute name |
| nix_err nix_make_attrs | ( | nix_c_context * | context, |
| Value * | value, | ||
| BindingsBuilder * | b | ||
| ) |
Create an attribute set from a bindings builder.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | b | bindings builder to use. Make sure to unref this afterwards. |
| BindingsBuilder * nix_make_bindings_builder | ( | nix_c_context * | context, |
| State * | state, | ||
| size_t | capacity | ||
| ) |
Create a bindings builder.
| [out] | context | Optional, stores error information |
| [in] | state | nix evaluator state |
| [in] | capacity | how many bindings you'll add. Don't exceed. |
| nix_err nix_make_list | ( | nix_c_context * | context, |
| State * | s, | ||
| Value * | value, | ||
| unsigned int | size | ||
| ) |
Allocate a list.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | size | size of list |
| nix_err nix_set_bool | ( | nix_c_context * | context, |
| Value * | value, | ||
| bool | b | ||
| ) |
Set boolean value.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | b | the boolean value |
| nix_err nix_set_external | ( | nix_c_context * | context, |
| Value * | value, | ||
| ExternalValue * | val | ||
| ) |
Set an external value.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | val | the external value to set. Will be GC-referenced by the value. |
| nix_err nix_set_float | ( | nix_c_context * | context, |
| Value * | value, | ||
| double | d | ||
| ) |
Set a float.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | d | the float, 64-bits |
| nix_err nix_set_int | ( | nix_c_context * | context, |
| Value * | value, | ||
| int64_t | i | ||
| ) |
Set an int.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | i | the int |
| nix_err nix_set_list_byidx | ( | nix_c_context * | context, |
| Value * | value, | ||
| unsigned int | ix, | ||
| Value * | elem | ||
| ) |
Manipulate a list by index.
Don't do this mid-computation.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | ix | index to manipulate |
| [in] | elem | the value to set, will be gc-referenced by the value |
| nix_err nix_set_null | ( | nix_c_context * | context, |
| Value * | value | ||
| ) |
Set null.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| nix_err nix_set_path_string | ( | nix_c_context * | context, |
| Value * | value, | ||
| const char * | str | ||
| ) |
Set a path.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | str | the path string, copied |
| nix_err nix_set_primop | ( | nix_c_context * | context, |
| Value * | value, | ||
| PrimOp * | op | ||
| ) |
Set primop.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | op | primop, will be gc-referenced by the value |
| nix_err nix_set_string | ( | nix_c_context * | context, |
| Value * | value, | ||
| const char * | str | ||
| ) |
Set a string.
| [out] | context | Optional, stores error information |
| [out] | value | Nix value to modify |
| [in] | str | the string, copied |