Advertisement
avp210159

scalc.h

Feb 1st, 2016
596
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.10 KB | None | 0 0
  1. // avp 2016 (for ru.stackoverflow.com)
  2. #ifndef _SCALC_H
  3. #define _SCALC_H
  4.  
  5. #define CALC_OK         0
  6. #define CALC_OUT_OF_MEM 1
  7. #define CALC_NO_OP      2  // two operands without operation beetwen them
  8. #define CALC_NO_VAL     3  // operand expected, but found ')' or operation
  9. #define CALC_NO_RP      4  // unbalanced '(' ('(' found in stack by EOF)
  10. #define CALC_NO_LP      5  // unbalanced ')' ('(' not found in stack)
  11. #define CALC_ERR_OP     6  // invalid operation in expr() (internal error)
  12. #define CALC_NO_NUMS    7  // no operands for current operation
  13. #define CALC_NUMS_ERR   8  // at end operands stack depth greater than 1
  14. #define CALC_OPRS_ERR   9  // at end operations left in stack
  15. #define CALC_ERR_INPUT  10 // invalid input char (letter, graph ...)
  16. #define CALC_NO_INPUT   11 // empty input
  17. #define CALC_ERR_CODE   12 // invalid rc for message
  18. #define CALC_EOD        13 // EOF
  19.  
  20.  
  21. extern
  22. #ifdef __cplusplus
  23. "C" {
  24. #endif
  25.   // scalc.c http://pastebin.com/stQw5kyc
  26.   int scalc (const char *str, double *pres);
  27.   const char *scalc_strerr (int code);
  28. #ifdef __cplusplus
  29. }
  30. #endif
  31.  
  32. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement