Andi Kleen | 0751673 | 2017-03-20 13:17:05 -0700 | [diff] [blame] | 1 | #ifndef PARSE_CTX_H |
| 2 | #define PARSE_CTX_H 1 |
| 3 | |
| 4 | #define EXPR_MAX_OTHER 8 |
| 5 | #define MAX_PARSE_ID EXPR_MAX_OTHER |
| 6 | |
| 7 | struct parse_id { |
| 8 | const char *name; |
| 9 | double val; |
| 10 | }; |
| 11 | |
| 12 | struct parse_ctx { |
| 13 | int num_ids; |
| 14 | struct parse_id ids[MAX_PARSE_ID]; |
| 15 | }; |
| 16 | |
| 17 | void expr__ctx_init(struct parse_ctx *ctx); |
| 18 | void expr__add_id(struct parse_ctx *ctx, const char *id, double val); |
| 19 | #ifndef IN_EXPR_Y |
| 20 | int expr__parse(double *final_val, struct parse_ctx *ctx, const char **pp); |
| 21 | #endif |
| 22 | int expr__find_other(const char *p, const char *one, const char ***other, |
| 23 | int *num_other); |
| 24 | |
| 25 | #endif |