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