| 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 | typedef enum _lttv_expression_op |
| 26 | { LTTV_FIELD_EQ, |
| 27 | LTTV_FIELD_NE, |
| 28 | LTTV_FIELD_LT, |
| 29 | LTTV_FIELD_LE, |
| 30 | LTTV_FIELD_GT, |
| 31 | LTTV_FIELD_GE |
| 32 | } lttv_expression_op; |
| 33 | |
| 34 | typedef _lttv_simple_expression |
| 35 | { lttv_expression_op op; |
| 36 | char *field_name; |
| 37 | char *value; |
| 38 | } lttv_simple_expression; |
| 39 | |
| 40 | typedef _lttv_expression_type |
| 41 | { LTTV_EXPRESSION, |
| 42 | LTTV_SIMPLE_EXPRESSION |
| 43 | |
| 44 | } |
| 45 | typedef struct _lttv_expression |
| 46 | { bool or; |
| 47 | bool not; |
| 48 | bool simple_expression; |
| 49 | union |
| 50 | { lttv_expression *e; |
| 51 | lttv_field_relation *se; |
| 52 | } e; |
| 53 | } lttv_expression; |
| 54 | |
| 55 | read_token |
| 56 | |
| 57 | read_expression |
| 58 | ( read expr ) |
| 59 | simple expr [ op expr ] |
| 60 | |
| 61 | read_simple_expression |
| 62 | read_field_path [ rel value ] |
| 63 | |
| 64 | read_field_path |
| 65 | read_field_component [. field path] |
| 66 | |
| 67 | read_field_component |
| 68 | name [ \[ value \] ] |
| 69 | |
| 70 | data struct: |
| 71 | and/or(left/right) |
| 72 | not(child) |
| 73 | op(left/right) |
| 74 | path(component...) -> field |
| 75 | |
| 76 | |