-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalue.h
More file actions
35 lines (30 loc) · 738 Bytes
/
value.h
File metadata and controls
35 lines (30 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef VALUE_H
#define VALUE_H
#include <stddef.h>
typedef enum {
VALUE_NULL,
VALUE_STRING,
VALUE_NUMBER,
VALUE_BOOL,
VALUE_LIST
} ValKind;
typedef struct Value {
ValKind kind;
char *str;
double num;
struct Value **items;
size_t n_items;
} Value;
Value *val_null(void);
Value *val_str(const char *s);
Value *val_num(double x);
Value *val_bool(unsigned int b);
Value *val_list(void);
int val_equals(Value *v1,Value *v2);
int val_compare(const Value *a, const Value *b);
int val_compare_sort(const Value *a, const Value *b);
void val_list_append(Value *L, Value *it);
void val_free(Value *v);
Value *val_dup(const Value *src);
char *value_to_string(const Value *v);
#endif