diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-10-12 15:46:36 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-10-12 15:46:36 -0400 |
commit | 63a0bed13ccf205793e9101012028dcd3feaa454 (patch) | |
tree | eaeb18a108f07b5e7e6cb016213689fd5ec3c4b3 /parse-events.c | |
parent | fe199059f0caf4df404ab6a8dcb08feec41eca61 (diff) |
handle array in print field
This may only handle the array parsing. It does not do anything with
the output (yet).
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'parse-events.c')
-rw-r--r-- | parse-events.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/parse-events.c b/parse-events.c index 80e31d3..482fd3f 100644 --- a/parse-events.c +++ b/parse-events.c | |||
@@ -1024,6 +1024,35 @@ out_free: | |||
1024 | return EVENT_ERROR; | 1024 | return EVENT_ERROR; |
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | enum event_type | ||
1028 | process_array(struct event *event, struct print_arg *top, char **tok) | ||
1029 | { | ||
1030 | struct print_arg *arg; | ||
1031 | enum event_type type; | ||
1032 | char *token = NULL; | ||
1033 | |||
1034 | arg = malloc_or_die(sizeof(*arg)); | ||
1035 | memset(arg, 0, sizeof(*arg)); | ||
1036 | |||
1037 | *tok = NULL; | ||
1038 | type = process_arg(event, arg, &token); | ||
1039 | if (test_type_token(type, token, EVENT_OP, "]")) | ||
1040 | goto out_free; | ||
1041 | |||
1042 | top->op.right = arg; | ||
1043 | |||
1044 | free_token(token); | ||
1045 | type = read_token_item(&token); | ||
1046 | *tok = token; | ||
1047 | |||
1048 | return type; | ||
1049 | |||
1050 | out_free: | ||
1051 | free_token(*tok); | ||
1052 | free_arg(arg); | ||
1053 | return EVENT_ERROR; | ||
1054 | } | ||
1055 | |||
1027 | static int get_op_prio(char *op) | 1056 | static int get_op_prio(char *op) |
1028 | { | 1057 | { |
1029 | if (!op[1]) { | 1058 | if (!op[1]) { |
@@ -1168,6 +1197,17 @@ process_op(struct event *event, struct print_arg *arg, char **tok) | |||
1168 | 1197 | ||
1169 | arg->op.right = right; | 1198 | arg->op.right = right; |
1170 | 1199 | ||
1200 | } else if (strcmp(token, "[") == 0) { | ||
1201 | |||
1202 | left = malloc_or_die(sizeof(*left)); | ||
1203 | |||
1204 | arg->type = PRINT_OP; | ||
1205 | arg->op.op = token; | ||
1206 | arg->op.left = left; | ||
1207 | |||
1208 | arg->op.prio = 0; | ||
1209 | type = process_array(event, arg, tok); | ||
1210 | |||
1171 | } else { | 1211 | } else { |
1172 | die("unknown op '%s'", token); | 1212 | die("unknown op '%s'", token); |
1173 | /* the arg is now the left side */ | 1213 | /* the arg is now the left side */ |