expr.h 588 B

123456789101112131415161718192021222324252627
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef PARSE_CTX_H
  3. #define PARSE_CTX_H 1
  4. #define EXPR_MAX_OTHER 15
  5. #define MAX_PARSE_ID EXPR_MAX_OTHER
  6. struct parse_id {
  7. const char *name;
  8. double val;
  9. };
  10. struct parse_ctx {
  11. int num_ids;
  12. struct parse_id ids[MAX_PARSE_ID];
  13. };
  14. void expr__ctx_init(struct parse_ctx *ctx);
  15. void expr__add_id(struct parse_ctx *ctx, const char *id, double val);
  16. #ifndef IN_EXPR_Y
  17. int expr__parse(double *final_val, struct parse_ctx *ctx, const char **pp);
  18. #endif
  19. int expr__find_other(const char *p, const char *one, const char ***other,
  20. int *num_other);
  21. #endif