ae.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * ae.h
  3. * evaluate arithmetic expressions at run time
  4. * Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>
  5. * 06 May 2010 23:45:53
  6. * This code is hereby placed in the public domain.
  7. */
  8. /*!
  9. Opens ae to be used. Call it once before calling the others.
  10. Does nothing if ae is already open.
  11. */
  12. void ae_open(void);
  13. /*!
  14. Closes ae after use. All variables are deleted.
  15. Does nothing if ae is already closed.
  16. */
  17. void ae_close(void);
  18. /*!
  19. Sets the value of a variable.
  20. The value persists until it is set again or ae is closed.
  21. */
  22. double ae_set(const char *name, double value);
  23. /*!
  24. Evaluates the given expression and returns its value.
  25. Once ae has seen an expression, ae can evaluate it repeatedly quickly.
  26. Returns 0 if there is an error. ae_error returns the error message.
  27. */
  28. double ae_eval(const char *expression);
  29. /*!
  30. Returns the last error message or NULL if there is none.
  31. */
  32. const char *ae_error(void);
  33. /*- End of file ------------------------------------------------------------*/