diff options
Diffstat (limited to 'value.h')
-rw-r--r-- | value.h | 40 |
1 files changed, 9 insertions, 31 deletions
@@ -29,6 +29,8 @@ #include <stdio.h> +#include "types.h" + typedef enum { TAG_INVAL = 0, TAG_NUM = 1, @@ -39,43 +41,19 @@ typedef enum { TAG_PTR = 6 } uc_value_type_t; -typedef struct { - size_t isize; - size_t dsize; - uint64_t *index; - char *data; -} uc_value_list; - -json_object *uc_double_new(double v); - -bool uc_eq(json_object *v1, json_object *v2); -bool uc_cmp(int how, json_object *v1, json_object *v2); -bool uc_val_is_truish(json_object *val); +bool uc_cmp(int how, uc_value_t *v1, uc_value_t *v2); +bool uc_val_is_truish(uc_value_t *val); -enum json_type uc_cast_number(json_object *v, int64_t *n, double *d); +uc_type_t uc_cast_number(uc_value_t *v, int64_t *n, double *d); -json_object *uc_getval(json_object *scope, json_object *key); -json_object *uc_setval(json_object *scope, json_object *key, json_object *val); +uc_value_t *uc_getval(uc_vm *, uc_value_t *scope, uc_value_t *key); +uc_value_t *uc_setval(uc_vm *, uc_value_t *scope, uc_value_t *key, uc_value_t *val); void uc_vallist_init(uc_value_list *list); void uc_vallist_free(uc_value_list *list); -ssize_t uc_vallist_add(uc_value_list *list, json_object *value); +ssize_t uc_vallist_add(uc_value_list *list, uc_value_t *value); uc_value_type_t uc_vallist_type(uc_value_list *list, size_t idx); -struct json_object *uc_vallist_get(uc_value_list *list, size_t idx); - -#define uc_value_get(val) \ - ({ \ - struct json_object *__o = val; \ - /*fprintf(stderr, "get(%p // %s) [%d + 1] @ %s:%d\n", __o, json_object_to_json_string(__o), getrefcnt(__o), __FILE__, __LINE__);*/ \ - json_object_get(__o); \ - }) - -#define uc_value_put(val) \ - ({ \ - struct json_object *__o = val; \ - /*fprintf(stderr, "put(%p // %s) [%d - 1] @ %s:%d\n", __o, json_object_to_json_string(__o), getrefcnt(__o), __FILE__, __LINE__);*/ \ - json_object_put(__o); \ - }) +uc_value_t *uc_vallist_get(uc_value_list *list, size_t idx); #endif /* __VALUE_H_ */ |