File size: 2,516 Bytes
16a8ff1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# 7.20 General utilities <stdlib.h>

# deprecated cimports for backwards compatibility:
from libc.string cimport const_char, const_void


cdef extern from "<stdlib.h>" nogil:

    # 7.20.1 Numeric conversion functions
    int atoi (const char *string)

    long atol (const char *string)

    long long atoll (const char *string)

    double atof (const char *string)

    long strtol (const char *string, char **tailptr, int base)

    unsigned long int strtoul (const char *string, char **tailptr, int base)

    long long int strtoll (const char *string, char **tailptr, int base)

    unsigned long long int strtoull (const char *string, char **tailptr, int base)

    float strtof (const char *string, char **tailptr)

    double strtod (const char *string, char **tailptr)

    long double strtold (const char *string, char **tailptr)



    # 7.20.2 Pseudo-random sequence generation functions

    enum: RAND_MAX

    int rand ()

    void srand (unsigned int seed)



    # 7.20.3 Memory management functions

    void *calloc (size_t count, size_t eltsize)

    void free (void *ptr)

    void *malloc (size_t size)

    void *realloc (void *ptr, size_t newsize)



    # 7.20.4 Communication with the environment

    enum: EXIT_FAILURE

    enum: EXIT_SUCCESS

    void exit (int status)

    void _exit (int status)

    int atexit (void (*function) ())

    void abort ()

    char *getenv (const char *name)

    int system (const char *command)



    #7.20.5 Searching and sorting utilities

    void *bsearch (const void *key, const void *array,

                   size_t count, size_t size,

                   int (*compare)(const void *, const void *))

    void qsort (void *array, size_t count, size_t size,

                int (*compare)(const void *, const void *))



    # 7.20.6 Integer arithmetic functions

    int abs (int number)

    long int labs (long int number)

    long long int llabs (long long int number)

    ctypedef struct div_t:

        int quot

        int rem

    div_t div (int numerator, int denominator)

    ctypedef struct ldiv_t:

        long int quot

        long int rem

    ldiv_t ldiv (long int numerator, long int denominator)

    ctypedef struct lldiv_t:

        long long int quot

        long long int rem

    lldiv_t lldiv (long long int numerator, long long int denominator)





    # 7.20.7 Multibyte/wide character conversion functions

    # XXX TODO



    # 7.20.8 Multibyte/wide string conversion functions

    # XXX TODO