10f339e6be931f6af0ca9d24683b10fad42490e6
[lttng-tools.git] / src / lib / lttng-ctl / filter / filter-ir.h
1 #ifndef _FILTER_IR_H
2 #define _FILTER_IR_H
3
4 /*
5 * filter-ir.h
6 *
7 * LTTng filter ir
8 *
9 * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 *
11 * This library is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU Lesser General Public License, version 2.1 only,
13 * as published by the Free Software Foundation.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 */
24
25 #include "filter-ast.h"
26
27 enum ir_op_signedness {
28 IR_SIGN_UNKNOWN = 0,
29 IR_SIGNED,
30 IR_UNSIGNED,
31 IR_SIGN_DYN, /* signedness determined dynamically */
32 };
33
34 enum ir_data_type {
35 IR_DATA_UNKNOWN = 0,
36 IR_DATA_STRING,
37 IR_DATA_NUMERIC, /* numeric and boolean */
38 IR_DATA_FLOAT,
39 IR_DATA_FIELD_REF,
40 IR_DATA_GET_CONTEXT_REF,
41 };
42
43 enum ir_op_type {
44 IR_OP_UNKNOWN = 0,
45 IR_OP_ROOT,
46 IR_OP_LOAD,
47 IR_OP_UNARY,
48 IR_OP_BINARY,
49 IR_OP_LOGICAL,
50 };
51
52 /* left or right child */
53 enum ir_side {
54 IR_SIDE_UNKNOWN = 0,
55 IR_LEFT,
56 IR_RIGHT,
57 };
58
59 enum ir_load_string_type {
60 /* Plain, no globbing at all: `hello world`. */
61 IR_LOAD_STRING_TYPE_PLAIN = 0,
62
63 /* Star at the end only: `hello *`. */
64 IR_LOAD_STRING_TYPE_GLOB_STAR_END,
65
66 /* At least one star, anywhere, but not at the end only: `he*wor*`. */
67 IR_LOAD_STRING_TYPE_GLOB_STAR,
68 };
69
70 struct ir_op_root {
71 struct ir_op *child;
72 };
73
74 struct ir_op_load {
75 union {
76 struct {
77 enum ir_load_string_type type;
78 char *value;
79 } string;
80 int64_t num;
81 double flt;
82 char *ref;
83 } u;
84 };
85
86 struct ir_op_unary {
87 enum unary_op_type type;
88 struct ir_op *child;
89 };
90
91 struct ir_op_binary {
92 enum op_type type;
93 struct ir_op *left;
94 struct ir_op *right;
95 };
96
97 struct ir_op_logical {
98 enum op_type type;
99 struct ir_op *left;
100 struct ir_op *right;
101 };
102
103 struct ir_op {
104 /* common to all ops */
105 enum ir_op_type op;
106 enum ir_data_type data_type;
107 enum ir_op_signedness signedness;
108 enum ir_side side;
109
110 union {
111 struct ir_op_root root;
112 struct ir_op_load load;
113 struct ir_op_unary unary;
114 struct ir_op_binary binary;
115 struct ir_op_logical logical;
116 } u;
117 };
118
119 #endif /* _FILTER_IR_H */
This page took 0.046772 seconds and 4 git commands to generate.