blob: 046160831f905229b8c30163622fbceec30aff73 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Andi Kleen07516732017-03-20 13:17:05 -07002#ifndef PARSE_CTX_H
3#define PARSE_CTX_H 1
4
Andi Kleen8d3db2b2017-08-11 16:26:24 -07005#define EXPR_MAX_OTHER 15
Andi Kleen07516732017-03-20 13:17:05 -07006#define MAX_PARSE_ID EXPR_MAX_OTHER
7
8struct parse_id {
9 const char *name;
10 double val;
11};
12
13struct parse_ctx {
14 int num_ids;
15 struct parse_id ids[MAX_PARSE_ID];
16};
17
18void expr__ctx_init(struct parse_ctx *ctx);
19void expr__add_id(struct parse_ctx *ctx, const char *id, double val);
20#ifndef IN_EXPR_Y
21int expr__parse(double *final_val, struct parse_ctx *ctx, const char **pp);
22#endif
23int expr__find_other(const char *p, const char *one, const char ***other,
24 int *num_other);
25
26#endif