expr.h (7e06a5e30a0c5155291efab8cf866ffea052f829) expr.h (114a9d6e396eeb061fa532803ff9a6fd3a966ad8)
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef PARSE_CTX_H
3#define PARSE_CTX_H 1
4
5// There are fixes that need to land upstream before we can use libbpf's headers,
6// for now use our copy unconditionally, since the data structures at this point
7// are exactly the same, no problem.
8//#ifdef HAVE_LIBBPF_SUPPORT

--- 16 unchanged lines hidden (view full) ---

25
26struct expr_id_data;
27
28struct expr_scanner_ctx {
29 int start_token;
30 int runtime;
31};
32
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef PARSE_CTX_H
3#define PARSE_CTX_H 1
4
5// There are fixes that need to land upstream before we can use libbpf's headers,
6// for now use our copy unconditionally, since the data structures at this point
7// are exactly the same, no problem.
8//#ifdef HAVE_LIBBPF_SUPPORT

--- 16 unchanged lines hidden (view full) ---

25
26struct expr_id_data;
27
28struct expr_scanner_ctx {
29 int start_token;
30 int runtime;
31};
32
33struct hashmap *ids__new(void);
34void ids__free(struct hashmap *ids);
35int ids__insert(struct hashmap *ids, const char *id, struct expr_id *parent);
36/*
37 * Union two sets of ids (hashmaps) and construct a third, freeing ids1 and
38 * ids2.
39 */
40struct hashmap *ids__union(struct hashmap *ids1, struct hashmap *ids2);
41
33struct expr_parse_ctx *expr__ctx_new(void);
34void expr__ctx_clear(struct expr_parse_ctx *ctx);
35void expr__ctx_free(struct expr_parse_ctx *ctx);
42struct expr_parse_ctx *expr__ctx_new(void);
43void expr__ctx_clear(struct expr_parse_ctx *ctx);
44void expr__ctx_free(struct expr_parse_ctx *ctx);
45
36void expr__del_id(struct expr_parse_ctx *ctx, const char *id);
37int expr__add_id(struct expr_parse_ctx *ctx, const char *id);
38int expr__add_id_val(struct expr_parse_ctx *ctx, const char *id, double val);
39int expr__add_ref(struct expr_parse_ctx *ctx, struct metric_ref *ref);
40int expr__get_id(struct expr_parse_ctx *ctx, const char *id,
41 struct expr_id_data **data);
42int expr__resolve_id(struct expr_parse_ctx *ctx, const char *id,
43 struct expr_id_data **datap);
46void expr__del_id(struct expr_parse_ctx *ctx, const char *id);
47int expr__add_id(struct expr_parse_ctx *ctx, const char *id);
48int expr__add_id_val(struct expr_parse_ctx *ctx, const char *id, double val);
49int expr__add_ref(struct expr_parse_ctx *ctx, struct metric_ref *ref);
50int expr__get_id(struct expr_parse_ctx *ctx, const char *id,
51 struct expr_id_data **data);
52int expr__resolve_id(struct expr_parse_ctx *ctx, const char *id,
53 struct expr_id_data **datap);
54
44int expr__parse(double *final_val, struct expr_parse_ctx *ctx,
45 const char *expr, int runtime);
55int expr__parse(double *final_val, struct expr_parse_ctx *ctx,
56 const char *expr, int runtime);
57
46int expr__find_ids(const char *expr, const char *one,
47 struct expr_parse_ctx *ids, int runtime);
48
49double expr_id_data__value(const struct expr_id_data *data);
50struct expr_id *expr_id_data__parent(struct expr_id_data *data);
51
52#endif
58int expr__find_ids(const char *expr, const char *one,
59 struct expr_parse_ctx *ids, int runtime);
60
61double expr_id_data__value(const struct expr_id_data *data);
62struct expr_id *expr_id_data__parent(struct expr_id_data *data);
63
64#endif