Implement support for brackets in filter expressions
[lttng-tools.git] / src / lib / lttng-ctl / filter / filter-ir.h
CommitLineData
953192ba
MD
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
27enum ir_op_signedness {
28 IR_SIGN_UNKNOWN = 0,
29 IR_SIGNED,
30 IR_UNSIGNED,
31 IR_SIGN_DYN, /* signedness determined dynamically */
32};
33
34enum ir_data_type {
35 IR_DATA_UNKNOWN = 0,
36 IR_DATA_STRING,
37 IR_DATA_NUMERIC, /* numeric and boolean */
e90d8561 38 IR_DATA_FLOAT,
953192ba 39 IR_DATA_FIELD_REF,
586dc72f 40 IR_DATA_GET_CONTEXT_REF,
661dfdd1
MD
41 IR_DATA_FIELD_REF_INDEX,
42 IR_DATA_GET_CONTEXT_REF_INDEX,
953192ba
MD
43};
44
45enum ir_op_type {
46 IR_OP_UNKNOWN = 0,
47 IR_OP_ROOT,
48 IR_OP_LOAD,
49 IR_OP_UNARY,
50 IR_OP_BINARY,
51 IR_OP_LOGICAL,
52};
53
54/* left or right child */
55enum ir_side {
56 IR_SIDE_UNKNOWN = 0,
57 IR_LEFT,
58 IR_RIGHT,
59};
60
9f449915
PP
61enum ir_load_string_type {
62 /* Plain, no globbing at all: `hello world`. */
63 IR_LOAD_STRING_TYPE_PLAIN = 0,
64
65 /* Star at the end only: `hello *`. */
66 IR_LOAD_STRING_TYPE_GLOB_STAR_END,
67
68 /* At least one star, anywhere, but not at the end only: `he*wor*`. */
69 IR_LOAD_STRING_TYPE_GLOB_STAR,
70};
71
953192ba
MD
72struct ir_op_root {
73 struct ir_op *child;
74};
75
76struct ir_op_load {
77 union {
9f449915
PP
78 struct {
79 enum ir_load_string_type type;
80 char *value;
81 } string;
953192ba 82 int64_t num;
e90d8561 83 double flt;
953192ba 84 char *ref;
661dfdd1
MD
85 struct {
86 char *symbol;
87 uint64_t index;
88 } ref_index;
953192ba
MD
89 } u;
90};
91
92struct ir_op_unary {
93 enum unary_op_type type;
94 struct ir_op *child;
95};
96
97struct ir_op_binary {
98 enum op_type type;
99 struct ir_op *left;
100 struct ir_op *right;
101};
102
103struct ir_op_logical {
104 enum op_type type;
105 struct ir_op *left;
106 struct ir_op *right;
107};
108
109struct ir_op {
110 /* common to all ops */
111 enum ir_op_type op;
112 enum ir_data_type data_type;
113 enum ir_op_signedness signedness;
114 enum ir_side side;
115
116 union {
117 struct ir_op_root root;
118 struct ir_op_load load;
119 struct ir_op_unary unary;
120 struct ir_op_binary binary;
121 struct ir_op_logical logical;
122 } u;
123};
124
125#endif /* _FILTER_IR_H */
This page took 0.040942 seconds and 4 git commands to generate.