Commit | Line | Data |
---|---|---|
980c17b1 MD |
1 | // SPDX-License-Identifier: MIT |
2 | /* | |
3 | * Copyright 2024 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
4 | */ | |
5 | ||
6 | #ifndef _VISIT_ARG_VEC_H | |
7 | #define _VISIT_ARG_VEC_H | |
8 | ||
9 | #include <side/trace.h> | |
10 | ||
11 | enum side_type_visitor_location { | |
12 | SIDE_TYPE_VISITOR_BEFORE, | |
13 | SIDE_TYPE_VISITOR_AFTER, | |
14 | }; | |
15 | ||
16 | struct side_type_visitor { | |
17 | void (*event_func)(enum side_type_visitor_location loc, | |
18 | const struct side_event_description *desc, | |
19 | const struct side_arg_vec *side_arg_vec, | |
20 | const struct side_arg_dynamic_struct *var_struct, | |
21 | void *caller_addr, | |
22 | void *priv); | |
23 | ||
24 | void (*static_fields_func)(enum side_type_visitor_location loc, | |
25 | const struct side_arg_vec *side_arg_vec, | |
26 | void *priv); | |
27 | ||
28 | void (*variadic_fields_func)(enum side_type_visitor_location loc, | |
29 | const struct side_arg_dynamic_struct *var_struct, | |
30 | void *priv); | |
31 | ||
32 | /* Stack-copy basic types. */ | |
33 | void (*field_func)(enum side_type_visitor_location loc, const struct side_event_field *item_desc, void *priv); | |
34 | void (*elem_func)(enum side_type_visitor_location loc, const struct side_type *type_desc, void *priv); | |
35 | ||
36 | void (*null_type_func)(const struct side_type *type_desc, const struct side_arg *item, void *priv); | |
37 | void (*bool_type_func)(const struct side_type *type_desc, const struct side_arg *item, void *priv); | |
38 | void (*integer_type_func)(const struct side_type *type_desc, const struct side_arg *item, void *priv); | |
39 | void (*byte_type_func)(const struct side_type *type_desc, const struct side_arg *item, void *priv); | |
40 | void (*pointer_type_func)(const struct side_type *type_desc, const struct side_arg *item, void *priv); | |
41 | void (*float_type_func)(const struct side_type *type_desc, const struct side_arg *item, void *priv); | |
42 | void (*string_type_func)(const struct side_type *type_desc, const struct side_arg *item, void *priv); | |
43 | ||
44 | /* Stack-copy compound types. */ | |
45 | void (*struct_type_func)(enum side_type_visitor_location loc, const struct side_type_struct *side_struct, const struct side_arg_vec *side_arg_vec, void *priv); | |
46 | void (*array_type_func)(enum side_type_visitor_location loc, const struct side_type_array *side_array, const struct side_arg_vec *side_arg_vec, void *priv); | |
47 | void (*vla_type_func)(enum side_type_visitor_location loc, const struct side_type_vla *side_vla, const struct side_arg_vec *side_arg_vec, void *priv); | |
48 | void (*vla_visitor_type_func)(enum side_type_visitor_location loc, const struct side_type_vla_visitor *side_vla_visitor, const struct side_arg_vla_visitor *side_arg_vla_visitor, void *priv); | |
49 | ||
50 | /* Stack-copy enumeration types. */ | |
51 | void (*enum_type_func)(const struct side_type *type_desc, const struct side_arg *item, void *priv); | |
52 | void (*enum_bitmap_type_func)(const struct side_type *type_desc, const struct side_arg *item, void *priv); | |
53 | ||
54 | /* Gather basic types. */ | |
55 | void (*gather_bool_type_func)(const struct side_type_gather_bool *type, const union side_bool_value *value, void *priv); | |
56 | void (*gather_byte_type_func)(const struct side_type_gather_byte *type, const uint8_t *_ptr, void *priv); | |
57 | void (*gather_integer_type_func)(const struct side_type_gather_integer *type, const union side_integer_value *value, void *priv); | |
58 | void (*gather_pointer_type_func)(const struct side_type_gather_integer *type, const union side_integer_value *value, void *priv); | |
59 | void (*gather_float_type_func)(const struct side_type_gather_float *type, const union side_float_value *value, void *priv); | |
60 | void (*gather_string_type_func)(const struct side_type_gather_string *type, const void *p, uint8_t unit_size, | |
61 | enum side_type_label_byte_order byte_order, size_t strlen_with_null, void *priv); | |
62 | ||
63 | /* Gather compound types. */ | |
64 | void (*gather_struct_type_func)(enum side_type_visitor_location loc, const struct side_type_struct *type, void *priv); | |
65 | void (*gather_array_type_func)(enum side_type_visitor_location loc, const struct side_type_array *type, void *priv); | |
66 | void (*gather_vla_type_func)(enum side_type_visitor_location loc, const struct side_type_vla *type, uint32_t length, void *priv); | |
67 | ||
68 | /* Gather enumeration types. */ | |
69 | void (*gather_enum_type_func)(const struct side_type_gather_enum *type, const union side_integer_value *value, void *priv); | |
70 | ||
71 | /* Dynamic basic types. */ | |
72 | void (*dynamic_field_func)(enum side_type_visitor_location loc, const struct side_arg_dynamic_field *field, void *priv); | |
73 | void (*dynamic_elem_func)(enum side_type_visitor_location loc, const struct side_arg *dynamic_item, void *priv); | |
74 | ||
75 | void (*dynamic_null_func)(const struct side_arg *item, void *priv); | |
76 | void (*dynamic_bool_func)(const struct side_arg *item, void *priv); | |
77 | void (*dynamic_integer_func)(const struct side_arg *item, void *priv); | |
78 | void (*dynamic_byte_func)(const struct side_arg *item, void *priv); | |
79 | void (*dynamic_pointer_func)(const struct side_arg *item, void *priv); | |
80 | void (*dynamic_float_func)(const struct side_arg *item, void *priv); | |
81 | void (*dynamic_string_func)(const struct side_arg *item, void *priv); | |
82 | ||
83 | /* Dynamic compound types. */ | |
84 | void (*dynamic_struct_func)(enum side_type_visitor_location loc, const struct side_arg_dynamic_struct *dynamic_struct, void *priv); | |
85 | void (*dynamic_struct_visitor_func)(enum side_type_visitor_location loc, const struct side_arg *item, void *priv); | |
86 | void (*dynamic_vla_func)(enum side_type_visitor_location loc, const struct side_arg_dynamic_vla *vla, void *priv); | |
87 | void (*dynamic_vla_visitor_func)(enum side_type_visitor_location loc, const struct side_arg *item, void *priv); | |
88 | }; | |
89 | ||
90 | void type_visitor_event(const struct side_type_visitor *type_visitor, | |
91 | const struct side_event_description *desc, | |
92 | const struct side_arg_vec *side_arg_vec, | |
93 | const struct side_arg_dynamic_struct *var_struct, | |
94 | void *caller_addr, void *priv); | |
95 | ||
96 | #endif /* _VISIT_ARG_VEC_H */ |