expr.h 549 B

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