diff options
author | Maria Matejka <mq@ucw.cz> | 2019-02-15 23:59:44 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2019-02-20 22:30:55 +0100 |
commit | ea4f55e3dcd472bb6d18c030839597ffd9583462 (patch) | |
tree | 1efc0ccd40f611ee17086b498155a884233b1520 /filter/f-inst.h | |
parent | 0b39b1cbb70c6f37a30a3130e1c308ddd0ba36de (diff) |
Filter: More cleanup -- customized structures also in struct f_line_item
Diffstat (limited to 'filter/f-inst.h')
-rw-r--r-- | filter/f-inst.h | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/filter/f-inst.h b/filter/f-inst.h index 201be5f8..5b397a5d 100644 --- a/filter/f-inst.h +++ b/filter/f-inst.h @@ -15,6 +15,11 @@ #include "filter/filter.h" #include "filter/data.h" +/* Flags for instructions */ +enum f_instruction_flags { + FIF_PRINTED = 1, /* FI_PRINT_AND_DIE: message put in buffer */ +} PACKED; + /* Include generated filter instruction declarations */ #include "filter/inst-gen.h" @@ -25,37 +30,9 @@ const char *f_instruction_name(enum f_instruction_code fi); struct f_inst *f_clear_local_vars(struct f_inst *decls); -/* Flags for instructions */ -enum f_instruction_flags { - FIF_PRINTED = 1, /* FI_PRINT_AND_DIE: message put in buffer */ -}; - /* Filter structures for execution */ struct f_line; -/* The single instruction item */ -struct f_line_item { - enum f_instruction_code fi_code; /* What to do */ - enum f_instruction_flags flags; /* Flags, instruction-specific */ - uint lineno; /* Where */ - union { - struct { - const struct f_val *vp; - const struct symbol *sym; - }; - struct f_val val; - const struct f_line *lines[2]; - enum filter_return fret; - struct f_static_attr sa; - struct f_dynamic_attr da; - enum ec_subtype ecs; - const char *s; - const struct f_tree *tree; - const struct rtable_config *rtc; - uint count; - }; /* Additional instruction data */ -}; - /* Line of instructions to be unconditionally executed one after another */ struct f_line { uint len; /* Line length */ @@ -68,6 +45,8 @@ struct f_line *f_postfixify_concat(const struct f_inst * const inst[], uint coun static inline struct f_line *f_postfixify(const struct f_inst *root) { return f_postfixify_concat(&root, 1); } +void f_dump_line(const struct f_line *, uint indent); + struct filter *f_new_where(const struct f_inst *); static inline struct f_dynamic_attr f_new_dynamic_attr(u8 type, u8 bit, enum f_type f_type, uint code) /* Type as core knows it, type as filters know it, and code of dynamic attribute */ { return (struct f_dynamic_attr) { .type = type, .bit = bit, .f_type = f_type, .ea_code = code }; } /* f_type currently unused; will be handy for static type checking */ |