stdlib.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* -*-comment-start: "//";comment-end:""-*-
  2. * GNU Mes --- Maxwell Equations of Software
  3. * Copyright © 2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  4. *
  5. * This file is part of GNU Mes.
  6. *
  7. * GNU Mes is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 3 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * GNU Mes is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef __MES_STDLIB_H
  21. #define __MES_STDLIB_H 1
  22. #ifndef __MES_COMPARISON_FN_T
  23. #define __MES_COMPARISON_FN_T
  24. typedef int (*comparison_fn_t) (void const *, void const *);
  25. #endif
  26. #if SYSTEM_LIBC
  27. #ifndef _GNU_SOURCE
  28. #define _GNU_SOURCE
  29. #endif
  30. #undef __MES_STDLIB_H
  31. #include_next <stdlib.h>
  32. #else // ! SYSTEM_LIBC
  33. #include <sys/types.h>
  34. #include <alloca.h>
  35. void abort (void);
  36. double atof (char const *s);
  37. int atoi (char const *s);
  38. int atexit (void (*function) (void));
  39. void *calloc (size_t nmemb, size_t size);
  40. void _exit (int status);
  41. void exit (int status);
  42. void free (void *ptr);
  43. char *getenv (char const *s);
  44. int setenv (char const *s, char const *v, int overwrite_p);
  45. void unsetenv (char const *name);
  46. void *malloc (size_t);
  47. void qsort (void *base, size_t nmemb, size_t size, int (*compar) (void const *, void const *));
  48. int rand (void);
  49. void *realloc (void *p, size_t size);
  50. double strtod (char const *string, char **tailptr);
  51. float strtof (char const *string, char **tailptr);
  52. long double strtold (char const *string, char **tailptr);
  53. long strtol (char const *string, char **tailptr, int base);
  54. long long strtoll (char const *string, char **tailptr, int base);
  55. unsigned long strtoul (char const *string, char **tailptr, int base);
  56. unsigned long long strtoull (char const *string, char **tailptr, int base);
  57. #define EXIT_FAILURE 1
  58. #define EXIT_SUCCESS 0
  59. void *bsearch (void const *key, void const *array, size_t count, size_t size, comparison_fn_t compare);
  60. #endif // ! SYSTEM_LIBC
  61. #endif // __MES_STDLIB_H