stdlib.pxd 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # 7.20 General utilities <stdlib.h>
  2. # deprecated cimports for backwards compatibility:
  3. from libc.string cimport const_char, const_void
  4. cdef extern from "<stdlib.h>" nogil:
  5. # 7.20.1 Numeric conversion functions
  6. int atoi (const char *string)
  7. long atol (const char *string)
  8. long long atoll (const char *string)
  9. double atof (const char *string)
  10. long strtol (const char *string, char **tailptr, int base)
  11. unsigned long int strtoul (const char *string, char **tailptr, int base)
  12. long long int strtoll (const char *string, char **tailptr, int base)
  13. unsigned long long int strtoull (const char *string, char **tailptr, int base)
  14. float strtof (const char *string, char **tailptr)
  15. double strtod (const char *string, char **tailptr)
  16. long double strtold (const char *string, char **tailptr)
  17. # 7.20.2 Pseudo-random sequence generation functions
  18. enum: RAND_MAX
  19. int rand ()
  20. void srand (unsigned int seed)
  21. # 7.20.3 Memory management functions
  22. void *calloc (size_t count, size_t eltsize)
  23. void free (void *ptr)
  24. void *malloc (size_t size)
  25. void *realloc (void *ptr, size_t newsize)
  26. # 7.20.4 Communication with the environment
  27. enum: EXIT_FAILURE
  28. enum: EXIT_SUCCESS
  29. void exit (int status)
  30. void _exit (int status)
  31. int atexit (void (*function) ())
  32. void abort ()
  33. char *getenv (const char *name)
  34. int system (const char *command)
  35. #7.20.5 Searching and sorting utilities
  36. void *bsearch (const void *key, const void *array,
  37. size_t count, size_t size,
  38. int (*compare)(const void *, const void *))
  39. void qsort (void *array, size_t count, size_t size,
  40. int (*compare)(const void *, const void *))
  41. # 7.20.6 Integer arithmetic functions
  42. int abs (int number)
  43. long int labs (long int number)
  44. long long int llabs (long long int number)
  45. ctypedef struct div_t:
  46. int quot
  47. int rem
  48. div_t div (int numerator, int denominator)
  49. ctypedef struct ldiv_t:
  50. long int quot
  51. long int rem
  52. ldiv_t ldiv (long int numerator, long int denominator)
  53. ctypedef struct lldiv_t:
  54. long long int quot
  55. long long int rem
  56. lldiv_t lldiv (long long int numerator, long long int denominator)
  57. # 7.20.7 Multibyte/wide character conversion functions
  58. # XXX TODO
  59. # 7.20.8 Multibyte/wide string conversion functions
  60. # XXX TODO