c_stdlib.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * c_stdlib.h
  3. *
  4. * Definitions for common types, variables, and functions.
  5. */
  6. #ifndef _C_STDLIB_H_
  7. #define _C_STDLIB_H_
  8. #include "c_stddef.h"
  9. #include "mem.h"
  10. #include <stdlib.h>
  11. #define EXIT_FAILURE 1
  12. #define EXIT_SUCCESS 0
  13. #define __INT_MAX__ 2147483647
  14. #undef __RAND_MAX
  15. #if __INT_MAX__ == 32767
  16. #define __RAND_MAX 32767
  17. #else
  18. #define __RAND_MAX 0x7fffffff
  19. #endif
  20. #define RAND_MAX __RAND_MAX
  21. #ifndef mem_realloc
  22. #define mem_realloc pvPortRealloc
  23. #endif
  24. #ifndef os_realloc
  25. #define os_realloc(p, s) mem_realloc((p), (s))
  26. #endif
  27. #define c_free os_free
  28. #define c_malloc os_malloc
  29. #define c_zalloc os_zalloc
  30. #define c_realloc os_realloc
  31. #define c_abs abs
  32. #define c_atoi atoi
  33. //#define c_strtod strtod
  34. #define c_strtol strtol
  35. #define c_strtoul strtoul
  36. // int c_abs(int);
  37. // void c_exit(int);
  38. //const char *c_getenv(const char *__string);
  39. // void *c_malloc(size_t __size);
  40. // void *c_zalloc(size_t __size);
  41. // void c_free(void *);
  42. // int c_rand(void);
  43. // void c_srand(unsigned int __seed);
  44. // int c_atoi(const char *__nptr);
  45. double c_strtod(const char *__n, char **__end_PTR);
  46. // // long c_strtol(const char *__n, char **__end_PTR, int __base);
  47. // unsigned long c_strtoul(const char *__n, char **__end_PTR, int __base);
  48. // // long long c_strtoll(const char *__n, char **__end_PTR, int __base);
  49. #endif /* _C_STDLIB_H_ */