added the module text/textFilter
[lttv.git] / ltt / branches / poly / lttv / lttv / filter.c
1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Michel Dagenais
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 * MA 02111-1307, USA.
17 */
18
19 /*
20 consist in AND, OR and NOT nested expressions, forming a tree with
21 simple relations as leaves. The simple relations test is a field
22 in an event is equal, not equal, smaller, smaller or equal, larger, or
23 larger or equal to a specified value. */
24
25 #include <lttv/filter.h>
26
27 typedef enum _lttv_expression_op
28 { LTTV_FIELD_EQ,
29 LTTV_FIELD_NE,
30 LTTV_FIELD_LT,
31 LTTV_FIELD_LE,
32 LTTV_FIELD_GT,
33 LTTV_FIELD_GE
34 } lttv_expression_op;
35
36 typedef enum _lttv_expression_type
37 {
38 LTTV_EXPRESSION,
39 LTTV_SIMPLE_EXPRESSION
40 } lttv_expression_type;
41
42 typedef struct _lttv_simple_expression
43 {
44 lttv_expression_op op;
45 char *field_name;
46 char *value;
47 } lttv_simple_expression;
48
49 typedef struct _lttv_expression
50 {
51 gboolean or;
52 gboolean not;
53 gboolean simple_expression;
54 // union e
55 // {
56 // lttv_expression *e;
57 // lttv_field_relation *se;
58 // };
59 } lttv_expression;
60
61 /*
62 read_token
63
64 read_expression
65 ( read expr )
66 simple expr [ op expr ]
67
68 read_simple_expression
69 read_field_path [ rel value ]
70
71 read_field_path
72 read_field_component [. field path]
73
74 read_field_component
75 name [ \[ value \] ]
76
77 data struct:
78 and/or(left/right)
79 not(child)
80 op(left/right)
81 path(component...) -> field
82 */
83
84 /**
85 * create a new lttv_filter
86 * @param expression filtering options string
87 * @param t pointer to the current LttvTrace
88 * @return the current lttv_filter
89 */
90 lttv_filter*
91 lttv_filter_new(char *expression, LttvTrace *t) {
92
93 g_print("filter::lttv_filter_new()\n"); /* debug */
94
95 /*
96 * 1. parse expression
97 * 2. construct binary tree
98 * 3. return corresponding filter
99 */
100
101
102 }
103
104 gboolean
105 lttv_filter_tracefile(lttv_filter *filter, void *tracefile) {
106
107 }
108
109 gboolean
110 lttv_filter_event(lttv_filter *filter, void *event) {
111
112 }
This page took 0.039657 seconds and 5 git commands to generate.