56typedef int64_t jx_int_t;
274struct jx * jx_lookup_guard(
struct jx *j,
const char *key,
int *found );
379const char *jx_get_key(
void **i);
387struct jx *jx_get_value(
void **i);
struct jx * jx_objectv(const char *key, struct jx *value,...)
Create a JX object.
struct jx * jx_remove(struct jx *object, struct jx *key)
Remove a key-value pair from an object.
void jx_insert_boolean(struct jx *object, const char *key, int value)
Insert a boolean value into an object.
void jx_insert_integer(struct jx *object, const char *key, jx_int_t value)
Insert an integer value into an object.
struct jx * jx_error(struct jx *err)
Create a JX_ERROR.
void jx_item_delete(struct jx_item *i)
Delete an array item.
struct jx * jx_symbol(const char *symbol_name)
Create a JX symbol.
struct jx * jx_array_shift(struct jx *array)
Remove and return the first element in the array.
int jx_isfalse(struct jx *j)
Test an expression for the boolean value FALSE.
struct jx * jx_string(const char *string_value)
Create a JX string value.
void jx_export(struct jx *j)
Export a jx object into the current environment using setenv().
const char * jx_lookup_string(struct jx *object, const char *key)
Search for a string item in an object.
int jx_insert(struct jx *object, struct jx *key, struct jx *value)
Insert a key-value pair into an object.
struct jx * jx_operator(jx_operator_t oper, struct jx *left, struct jx *right)
Create a JX binary expression,.
char * jx_lookup_string_dup(struct jx *object, const char *key)
Search for a string item in an object.
double jx_lookup_double(struct jx *object, const char *key)
Search for a double item in an object.
struct jx_pair * jx_pair(struct jx *key, struct jx *value, struct jx_pair *next)
Create a JX key-value pair.
struct jx * jx_double(double double_value)
Create a JX floating point value.
void jx_pair_delete(struct jx_pair *p)
Delete a key-value pair.
int jx_array_length(struct jx *array)
Get the length of an array.
int jx_istrue(struct jx *j)
Test an expression for the boolean value TRUE.
jx_int_t jx_lookup_integer(struct jx *object, const char *key)
Search for an integer item in an object.
void jx_comprehension_delete(struct jx_comprehension *comp)
Delete a comprehension.
struct jx * jx_arrayv(struct jx *value,...)
Create a JX array with inline items.
struct jx_item * jx_item(struct jx *value, struct jx_item *next)
Create a JX array item.
struct jx_comprehension * jx_comprehension(const char *variable, struct jx *elements, struct jx *condition, struct jx_comprehension *next)
Create a JX comprehension.
void jx_array_append(struct jx *array, struct jx *value)
Append an item at the end of an array.
struct jx * jx_null()
Create a JX null value.
int jx_istype(struct jx *j, jx_type_t type)
Test an expression's type.
struct jx * jx_array_concat(struct jx *array,...)
Concatenate the given arrays into a single array.
jx_type_t
JX atomic type.
Definition jx.h:43
@ JX_INTEGER
integer value
Definition jx.h:46
@ JX_ERROR
indicates failed evaluation
Definition jx.h:53
@ JX_OBJECT
object containing key-value pairs
Definition jx.h:51
@ JX_ARRAY
array containing values
Definition jx.h:50
@ JX_SYMBOL
variable identifier
Definition jx.h:49
@ JX_STRING
string value
Definition jx.h:48
@ JX_DOUBLE
floating point value
Definition jx.h:47
@ JX_BOOLEAN
true or false
Definition jx.h:45
@ JX_OPERATOR
operator on multiple values.
Definition jx.h:52
@ JX_NULL
null value
Definition jx.h:44
struct jx * jx_array(struct jx_item *items)
Create a JX array.
struct jx * jx_iterate_array(struct jx *j, void **i)
Iterate over the values in an array.
int jx_equals(struct jx *j, struct jx *k)
Test two expressions for equality.
struct jx * jx_integer(jx_int_t integer_value)
Create a JX integer value.
struct jx * jx_iterate_values(struct jx *j, void **i)
Iterate over the values in an object.
struct jx * jx_boolean(int boolean_value)
Create a JX boolean value.
const char * jx_iterate_keys(struct jx *j, void **i)
Iterate over the keys in an object.
int jx_isatomic(struct jx *j)
Test for an atomic value.
struct jx * jx_string_nocopy(char *string_value)
Create a JX string value without copying (uncommon).
struct jx * jx_array_index(struct jx *array, int nth)
Get the nth item in an array.
void jx_insert_double(struct jx *object, const char *key, double value)
Insert a double value into an object.
struct jx * jx_format(const char *fmt,...)
Create a JX string value using prinf style formatting.
struct jx * jx_object(struct jx_pair *pairs)
Create a JX object.
void jx_insert_string(struct jx *object, const char *key, const char *value)
Insert a string value into an object.
void jx_delete(struct jx *j)
Delete an expression recursively.
struct jx * jx_lookup(struct jx *object, const char *key)
Search for a arbitrary item in an object.
void jx_array_insert(struct jx *array, struct jx *value)
Insert an item at the beginning of an array.
int jx_lookup_boolean(struct jx *object, const char *key)
Search for a boolean item in an object.
struct jx * jx_copy(struct jx *j)
Duplicate an expression.
int jx_insert_unless_empty(struct jx *object, struct jx *key, struct jx *value)
Insert a key-value pair into an object, unless the value is an empty collection, in which case delete...
struct jx * jx_merge(struct jx *j,...)
Merge an arbitrary number of JX_OBJECTs into a single new one.
int jx_is_constant(struct jx *j)
Determine if an expression is constant.
struct jx * elements
items for list comprehension
Definition jx.h:62
char * variable
variable for comprehension
Definition jx.h:61
struct jx * condition
condition for filtering list comprehension
Definition jx.h:63
JX item linked-list used by JX_ARRAY and jx::items.
Definition jx.h:69
struct jx * value
value of this item
Definition jx.h:71
struct jx_item * next
pointer to next item
Definition jx.h:73
JX key-value pairs used by JX_OBJECT and jx::pairs.
Definition jx.h:78
struct jx * key
key of this pair
Definition jx.h:80
struct jx_pair * next
pointer to next pair
Definition jx.h:83
struct jx * value
value of this pair
Definition jx.h:81
JX value representing any expression type.
Definition jx.h:117
jx_int_t integer_value
value of JX_INTEGER
Definition jx.h:122
struct jx_item * items
value of JX_ARRAY
Definition jx.h:126
int boolean_value
value of JX_BOOLEAN
Definition jx.h:121
struct jx_pair * pairs
value of JX_OBJECT
Definition jx.h:127
struct jx_operator oper
value of JX_OPERATOR
Definition jx.h:128
struct jx * err
error value of JX_ERROR
Definition jx.h:129
double double_value
value of JX_DOUBLE
Definition jx.h:123
unsigned line
line where this value was defined
Definition jx.h:119
char * symbol_name
value of JX_SYMBOL
Definition jx.h:125
jx_type_t type
type of this value
Definition jx.h:118
char * string_value
value of JX_STRING
Definition jx.h:124