Add xterm-white.theme
[cmus.git] / expr.h
blob76e4a2d68074029dd40b3c002ce872855d89530e
1 /*
2 * Copyright 2005 Timo Hirvonen
3 */
5 #ifndef EXPR_H
6 #define EXPR_H
8 #include <track_info.h>
9 #include <list.h>
11 enum { OP_LT, OP_LE, OP_EQ, OP_GE, OP_GT, OP_NE };
12 #define NR_OPS (OP_NE + 1)
14 enum expr_type {
15 EXPR_AND,
16 EXPR_OR,
18 EXPR_NOT,
20 EXPR_STR,
21 EXPR_INT,
22 EXPR_BOOL
24 #define NR_EXPRS (EXPR_BOOL + 1)
26 struct expr {
27 struct expr *left, *right, *parent;
28 enum expr_type type;
29 char *key;
30 union {
31 struct {
32 struct list_head glob_head;
33 enum {
34 SOP_EQ = OP_EQ,
35 SOP_NE = OP_NE
36 } op;
37 } estr;
38 struct {
39 int val;
40 enum {
41 IOP_LT = OP_LT,
42 IOP_LE = OP_LE,
43 IOP_EQ = OP_EQ,
44 IOP_GE = OP_GE,
45 IOP_GT = OP_GT,
46 IOP_NE = OP_NE
47 } op;
48 } eint;
52 struct expr *expr_parse(const char *str);
53 int expr_check_leaves(struct expr **exprp, const char *(*get_filter)(const char *name));
54 int expr_eval(struct expr *expr, struct track_info *ti);
55 void expr_free(struct expr *expr);
56 const char *expr_error(void);
58 #endif