configure.ac: refer to a better URL for peg
[iwhd.git] / query.h
blob43901e42be7a7ed89891a950968d57686d856d6a
1 #if defined(__CPLUSPLUS__) || defined(__cplusplus)
2 extern "C" {
3 #endif
5 typedef enum {
6 C_LESSTHAN, C_LESSOREQ,
7 C_EQUAL, C_DIFFERENT,
8 C_GREATEROREQ, C_GREATERTHAN
9 } comp_t;
11 typedef enum {
12 T_NUMBER, T_STRING, T_OFIELD, T_SFIELD,
13 T_COMP, T_NOT, T_AND, T_OR
14 } type_t;
16 typedef struct _value {
17 type_t type;
18 union {
19 long long as_num;
20 char *as_str;
21 struct {
22 comp_t op;
23 struct _value *left;
24 struct _value *right;
25 } as_tree;
27 } value_t;
29 typedef struct {
30 char *(*func) (void *, char *);
31 void *ctx;
32 } getter_t;
33 #define CALL_GETTER(g,x) g->func(g->ctx,x)
36 value_t *parse (char *text);
37 int eval (value_t *expr, getter_t *oget, getter_t *sget);
38 void free_value (value_t *);
39 void print_value (value_t *);
41 #if defined(__CPLUSPLUS__) || defined(__cplusplus)
43 #endif