9c312311 |
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 | |
31452f49 |
19 | /* |
48f6f3c2 |
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 | |
31452f49 |
25 | #include <lttv/filter.h> |
26 | |
48f6f3c2 |
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 | |
31452f49 |
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; |
48f6f3c2 |
45 | char *field_name; |
46 | char *value; |
47 | } lttv_simple_expression; |
48 | |
48f6f3c2 |
49 | typedef struct _lttv_expression |
31452f49 |
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 | // }; |
48f6f3c2 |
59 | } lttv_expression; |
60 | |
31452f49 |
61 | /* |
62 | read_token |
48f6f3c2 |
63 | |
31452f49 |
64 | read_expression |
65 | ( read expr ) |
66 | simple expr [ op expr ] |
48f6f3c2 |
67 | |
31452f49 |
68 | read_simple_expression |
69 | read_field_path [ rel value ] |
48f6f3c2 |
70 | |
31452f49 |
71 | read_field_path |
72 | read_field_component [. field path] |
48f6f3c2 |
73 | |
31452f49 |
74 | read_field_component |
75 | name [ \[ value \] ] |
48f6f3c2 |
76 | |
31452f49 |
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) { |
48f6f3c2 |
92 | |
31452f49 |
93 | g_print("filter::lttv_filter_new()\n"); /* debug */ |
48f6f3c2 |
94 | |
31452f49 |
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 | } |