first commit
This commit is contained in:
commit
417e54da96
5696 changed files with 900003 additions and 0 deletions
|
@ -0,0 +1 @@
|
|||
# empty file
|
|
@ -0,0 +1,128 @@
|
|||
# 7.5 Errors <errno.h>
|
||||
|
||||
cdef extern from "<errno.h>" nogil:
|
||||
enum:
|
||||
EPERM
|
||||
ENOENT
|
||||
ESRCH
|
||||
EINTR
|
||||
EIO
|
||||
ENXIO
|
||||
E2BIG
|
||||
ENOEXEC
|
||||
EBADF
|
||||
ECHILD
|
||||
EAGAIN
|
||||
ENOMEM
|
||||
EACCES
|
||||
EFAULT
|
||||
ENOTBLK
|
||||
EBUSY
|
||||
EEXIST
|
||||
EXDEV
|
||||
ENODEV
|
||||
ENOTDIR
|
||||
EISDIR
|
||||
EINVAL
|
||||
ENFILE
|
||||
EMFILE
|
||||
ENOTTY
|
||||
ETXTBSY
|
||||
EFBIG
|
||||
ENOSPC
|
||||
ESPIPE
|
||||
EROFS
|
||||
EMLINK
|
||||
EPIPE
|
||||
EDOM
|
||||
ERANGE
|
||||
EDEADLOCK
|
||||
ENAMETOOLONG
|
||||
ENOLCK
|
||||
ENOSYS
|
||||
ENOTEMPTY
|
||||
ELOOP
|
||||
ENOMSG
|
||||
EIDRM
|
||||
ECHRNG
|
||||
EL2NSYNC
|
||||
EL3HLT
|
||||
EL3RST
|
||||
ELNRNG
|
||||
EUNATCH
|
||||
ENOCSI
|
||||
EL2HLT
|
||||
EBADE
|
||||
EBADR
|
||||
EXFULL
|
||||
ENOANO
|
||||
EBADRQC
|
||||
EBADSLT
|
||||
EBFONT
|
||||
ENOSTR
|
||||
ENODATA
|
||||
ENOATTR
|
||||
ETIME
|
||||
ENOSR
|
||||
ENONET
|
||||
ENOPKG
|
||||
EREMOTE
|
||||
ENOLINK
|
||||
EADV
|
||||
ESRMNT
|
||||
ECOMM
|
||||
EPROTO
|
||||
EMULTIHOP
|
||||
EDOTDOT
|
||||
EBADMSG
|
||||
EOVERFLOW
|
||||
ENOTUNIQ
|
||||
EBADFD
|
||||
EREMCHG
|
||||
ELIBACC
|
||||
ELIBBAD
|
||||
ELIBSCN
|
||||
ELIBMAX
|
||||
ELIBEXEC
|
||||
EILSEQ
|
||||
ERESTART
|
||||
ESTRPIPE
|
||||
EUSERS
|
||||
ENOTSOCK
|
||||
EDESTADDRREQ
|
||||
EMSGSIZE
|
||||
EPROTOTYPE
|
||||
ENOPROTOOPT
|
||||
EPROTONOSUPPORT
|
||||
ESOCKTNOSUPPORT
|
||||
EOPNOTSUPP
|
||||
EPFNOSUPPORT
|
||||
EAFNOSUPPORT
|
||||
EADDRINUSE
|
||||
EADDRNOTAVAIL
|
||||
ENETDOWN
|
||||
ENETUNREACH
|
||||
ENETRESET
|
||||
ECONNABORTED
|
||||
ECONNRESET
|
||||
ENOBUFS
|
||||
EISCONN
|
||||
ENOTCONN
|
||||
ESHUTDOWN
|
||||
ETOOMANYREFS
|
||||
ETIMEDOUT
|
||||
ECONNREFUSED
|
||||
EHOSTDOWN
|
||||
EHOSTUNREACH
|
||||
EALREADY
|
||||
EINPROGRESS
|
||||
ESTALE
|
||||
EUCLEAN
|
||||
ENOTNAM
|
||||
ENAVAIL
|
||||
EISNAM
|
||||
EREMOTEIO
|
||||
EDQUOT
|
||||
|
||||
int errno
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
# 5.2.4.2.2 Characteristics of floating types <float.h>
|
||||
|
||||
cdef extern from "<float.h>":
|
||||
|
||||
const float FLT_RADIX
|
||||
|
||||
const float FLT_MANT_DIG
|
||||
const double DBL_MANT_DIG
|
||||
const long double LDBL_MANT_DIG
|
||||
|
||||
const double DECIMAL_DIG
|
||||
|
||||
const float FLT_DIG
|
||||
const double DBL_DIG
|
||||
const long double LDBL_DIG
|
||||
|
||||
const float FLT_MIN_EXP
|
||||
const double DBL_MIN_EXP
|
||||
const long double LDBL_MIN_EXP
|
||||
|
||||
const float FLT_MIN_10_EXP
|
||||
const double DBL_MIN_10_EXP
|
||||
const long double LDBL_MIN_10_EXP
|
||||
|
||||
const float FLT_MAX_EXP
|
||||
const double DBL_MAX_EXP
|
||||
const long double LDBL_MAX_EXP
|
||||
|
||||
const float FLT_MAX_10_EXP
|
||||
const double DBL_MAX_10_EXP
|
||||
const long double LDBL_MAX_10_EXP
|
||||
|
||||
const float FLT_MAX
|
||||
const double DBL_MAX
|
||||
const long double LDBL_MAX
|
||||
|
||||
const float FLT_EPSILON
|
||||
const double DBL_EPSILON
|
||||
const long double LDBL_EPSILON
|
||||
|
||||
const float FLT_MIN
|
||||
const double DBL_MIN
|
||||
const long double LDBL_MIN
|
|
@ -0,0 +1,28 @@
|
|||
# 5.2.4.2.1 Sizes of integer types <limits.h>
|
||||
|
||||
cdef extern from "<limits.h>":
|
||||
const int CHAR_BIT
|
||||
const int MB_LEN_MAX
|
||||
|
||||
const char CHAR_MIN
|
||||
const char CHAR_MAX
|
||||
|
||||
const signed char SCHAR_MIN
|
||||
const signed char SCHAR_MAX
|
||||
const unsigned char UCHAR_MAX
|
||||
|
||||
const short SHRT_MIN
|
||||
const short SHRT_MAX
|
||||
const unsigned short USHRT_MAX
|
||||
|
||||
const int INT_MIN
|
||||
const int INT_MAX
|
||||
const unsigned int UINT_MAX
|
||||
|
||||
const long LONG_MIN
|
||||
const long LONG_MAX
|
||||
const unsigned long ULONG_MAX
|
||||
|
||||
const long long LLONG_MIN
|
||||
const long long LLONG_MAX
|
||||
const unsigned long long ULLONG_MAX
|
|
@ -0,0 +1,46 @@
|
|||
# 7.11 Localization <locale.h>
|
||||
|
||||
# deprecated cimport for backwards compatibility:
|
||||
from libc.string cimport const_char
|
||||
|
||||
|
||||
cdef extern from "<locale.h>" nogil:
|
||||
|
||||
struct lconv:
|
||||
char *decimal_point
|
||||
char *thousands_sep
|
||||
char *grouping
|
||||
char *mon_decimal_point
|
||||
char *mon_thousands_sep
|
||||
char *mon_grouping
|
||||
char *positive_sign
|
||||
char *negative_sign
|
||||
char *currency_symbol
|
||||
char frac_digits
|
||||
char p_cs_precedes
|
||||
char n_cs_precedes
|
||||
char p_sep_by_space
|
||||
char n_sep_by_space
|
||||
char p_sign_posn
|
||||
char n_sign_posn
|
||||
char *int_curr_symbol
|
||||
char int_frac_digits
|
||||
char int_p_cs_precedes
|
||||
char int_n_cs_precedes
|
||||
char int_p_sep_by_space
|
||||
char int_n_sep_by_space
|
||||
char int_p_sign_posn
|
||||
char int_n_sign_posn
|
||||
|
||||
enum: LC_ALL
|
||||
enum: LC_COLLATE
|
||||
enum: LC_CTYPE
|
||||
enum: LC_MONETARY
|
||||
enum: LC_NUMERIC
|
||||
enum: LC_TIME
|
||||
|
||||
# 7.11.1 Locale control
|
||||
char *setlocale (int category, const char *locale)
|
||||
|
||||
# 7.11.2 Numeric formatting convention inquiry
|
||||
lconv *localeconv ()
|
|
@ -0,0 +1,112 @@
|
|||
cdef extern from "<math.h>" nogil:
|
||||
const double M_E
|
||||
const double e "M_E" # as in Python's math module
|
||||
const double M_LOG2E
|
||||
const double M_LOG10E
|
||||
const double M_LN2
|
||||
const double M_LN10
|
||||
const double M_PI
|
||||
const double pi "M_PI" # as in Python's math module
|
||||
const double M_PI_2
|
||||
const double M_PI_4
|
||||
const double M_1_PI
|
||||
const double M_2_PI
|
||||
const double M_2_SQRTPI
|
||||
const double M_SQRT2
|
||||
const double M_SQRT1_2
|
||||
|
||||
# C99 constants
|
||||
const float INFINITY
|
||||
const float NAN
|
||||
# note: not providing "nan" and "inf" aliases here as nan() is a function in C
|
||||
const double HUGE_VAL
|
||||
const float HUGE_VALF
|
||||
const long double HUGE_VALL
|
||||
|
||||
double acos(double x)
|
||||
double asin(double x)
|
||||
double atan(double x)
|
||||
double atan2(double y, double x)
|
||||
double cos(double x)
|
||||
double sin(double x)
|
||||
double tan(double x)
|
||||
|
||||
double cosh(double x)
|
||||
double sinh(double x)
|
||||
double tanh(double x)
|
||||
double acosh(double x)
|
||||
double asinh(double x)
|
||||
double atanh(double x)
|
||||
|
||||
double hypot(double x, double y)
|
||||
|
||||
double exp(double x)
|
||||
double exp2(double x)
|
||||
double expm1(double x)
|
||||
double log(double x)
|
||||
double logb(double x)
|
||||
double log2(double x)
|
||||
double log10(double x)
|
||||
double log1p(double x)
|
||||
int ilogb(double x)
|
||||
|
||||
double lgamma(double x)
|
||||
double tgamma(double x)
|
||||
|
||||
double frexp(double x, int* exponent)
|
||||
double ldexp(double x, int exponent)
|
||||
|
||||
double modf(double x, double* iptr)
|
||||
double fmod(double x, double y)
|
||||
double remainder(double x, double y)
|
||||
double remquo(double x, double y, int *quot)
|
||||
double pow(double x, double y)
|
||||
double sqrt(double x)
|
||||
double cbrt(double x)
|
||||
|
||||
double fabs(double x)
|
||||
double ceil(double x)
|
||||
double floor(double x)
|
||||
double trunc(double x)
|
||||
double rint(double x)
|
||||
double round(double x)
|
||||
double nearbyint(double x)
|
||||
double nextafter(double, double)
|
||||
double nexttoward(double, long double)
|
||||
|
||||
long long llrint(double)
|
||||
long lrint(double)
|
||||
long long llround(double)
|
||||
long lround(double)
|
||||
|
||||
double copysign(double, double)
|
||||
float copysignf(float, float)
|
||||
long double copysignl(long double, long double)
|
||||
|
||||
double erf(double)
|
||||
float erff(float)
|
||||
long double erfl(long double)
|
||||
double erfc(double)
|
||||
float erfcf(float)
|
||||
long double erfcl(long double)
|
||||
|
||||
double fdim(double x, double y)
|
||||
double fma(double x, double y, double z)
|
||||
double fmax(double x, double y)
|
||||
double fmin(double x, double y)
|
||||
double scalbln(double x, long n)
|
||||
double scalbn(double x, int n)
|
||||
|
||||
double nan(const char*)
|
||||
|
||||
int isinf(long double) # -1 / 0 / 1
|
||||
bint isfinite(long double)
|
||||
bint isnan(long double)
|
||||
bint isnormal(long double)
|
||||
bint signbit(long double)
|
||||
int fpclassify(long double)
|
||||
const int FP_NAN
|
||||
const int FP_INFINITE
|
||||
const int FP_ZERO
|
||||
const int FP_SUBNORMAL
|
||||
const int FP_NORMAL
|
|
@ -0,0 +1,10 @@
|
|||
cdef extern from "<setjmp.h>" nogil:
|
||||
ctypedef struct jmp_buf:
|
||||
pass
|
||||
int setjmp(jmp_buf state)
|
||||
void longjmp(jmp_buf state, int value)
|
||||
|
||||
ctypedef struct sigjmp_buf:
|
||||
pass
|
||||
int sigsetjmp(sigjmp_buf state, int savesigs)
|
||||
void siglongjmp(sigjmp_buf state, int value)
|
|
@ -0,0 +1,64 @@
|
|||
# 7.14 Signal handling <signal.h>
|
||||
|
||||
ctypedef void (*sighandler_t)(int SIGNUM) nogil
|
||||
|
||||
cdef extern from "<signal.h>" nogil:
|
||||
|
||||
ctypedef int sig_atomic_t
|
||||
|
||||
sighandler_t SIG_DFL
|
||||
sighandler_t SIG_IGN
|
||||
sighandler_t SIG_ERR
|
||||
|
||||
sighandler_t signal (int signum, sighandler_t action)
|
||||
int raise_"raise" (int signum)
|
||||
|
||||
# Signals
|
||||
enum:
|
||||
# Program Error
|
||||
SIGFPE
|
||||
SIGILL
|
||||
SIGSEGV
|
||||
SIGBUS
|
||||
SIGABRT
|
||||
SIGIOT
|
||||
SIGTRAP
|
||||
SIGEMT
|
||||
SIGSYS
|
||||
SIGSTKFLT
|
||||
# Termination
|
||||
SIGTERM
|
||||
SIGINT
|
||||
SIGQUIT
|
||||
SIGKILL
|
||||
SIGHUP
|
||||
# Alarm
|
||||
SIGALRM
|
||||
SIGVTALRM
|
||||
SIGPROF
|
||||
# Asynchronous I/O
|
||||
SIGIO
|
||||
SIGURG
|
||||
SIGPOLL
|
||||
# Job Control
|
||||
SIGCHLD
|
||||
SIGCLD
|
||||
SIGCONT
|
||||
SIGSTOP
|
||||
SIGTSTP
|
||||
SIGTTIN
|
||||
SIGTTOU
|
||||
# Operation Error
|
||||
SIGPIPE
|
||||
SIGLOST
|
||||
SIGXCPU
|
||||
SIGXFSZ
|
||||
SIGPWR
|
||||
# Miscellaneous
|
||||
SIGUSR1
|
||||
SIGUSR2
|
||||
SIGWINCH
|
||||
SIGINFO
|
||||
# Real-time signals
|
||||
SIGRTMIN
|
||||
SIGRTMAX
|
|
@ -0,0 +1,9 @@
|
|||
# 7.17 Common definitions <stddef.h>
|
||||
|
||||
cdef extern from "<stddef.h>":
|
||||
|
||||
ctypedef signed int ptrdiff_t
|
||||
|
||||
ctypedef unsigned int size_t
|
||||
|
||||
ctypedef int wchar_t
|
|
@ -0,0 +1,105 @@
|
|||
# Longness only used for type promotion.
|
||||
# Actual compile time size used for conversions.
|
||||
|
||||
# 7.18 Integer types <stdint.h>
|
||||
cdef extern from "<stdint.h>" nogil:
|
||||
|
||||
# 7.18.1 Integer types
|
||||
# 7.18.1.1 Exact-width integer types
|
||||
ctypedef signed char int8_t
|
||||
ctypedef signed short int16_t
|
||||
ctypedef signed int int32_t
|
||||
ctypedef signed long int64_t
|
||||
ctypedef unsigned char uint8_t
|
||||
ctypedef unsigned short uint16_t
|
||||
ctypedef unsigned int uint32_t
|
||||
ctypedef unsigned long long uint64_t
|
||||
# 7.18.1.2 Minimum-width integer types
|
||||
ctypedef signed char int_least8_t
|
||||
ctypedef signed short int_least16_t
|
||||
ctypedef signed int int_least32_t
|
||||
ctypedef signed long int_least64_t
|
||||
ctypedef unsigned char uint_least8_t
|
||||
ctypedef unsigned short uint_least16_t
|
||||
ctypedef unsigned int uint_least32_t
|
||||
ctypedef unsigned long long uint_least64_t
|
||||
# 7.18.1.3 Fastest minimum-width integer types
|
||||
ctypedef signed char int_fast8_t
|
||||
ctypedef signed short int_fast16_t
|
||||
ctypedef signed int int_fast32_t
|
||||
ctypedef signed long int_fast64_t
|
||||
ctypedef unsigned char uint_fast8_t
|
||||
ctypedef unsigned short uint_fast16_t
|
||||
ctypedef unsigned int uint_fast32_t
|
||||
ctypedef unsigned long long uint_fast64_t
|
||||
# 7.18.1.4 Integer types capable of holding object pointers
|
||||
ctypedef ssize_t intptr_t
|
||||
ctypedef size_t uintptr_t
|
||||
# 7.18.1.5 Greatest-width integer types
|
||||
ctypedef signed long long intmax_t
|
||||
ctypedef unsigned long long uintmax_t
|
||||
|
||||
# 7.18.2 Limits of specified-width integer types
|
||||
# 7.18.2.1 Limits of exact-width integer types
|
||||
int8_t INT8_MIN
|
||||
int16_t INT16_MIN
|
||||
int32_t INT32_MIN
|
||||
int64_t INT64_MIN
|
||||
int8_t INT8_MAX
|
||||
int16_t INT16_MAX
|
||||
int32_t INT32_MAX
|
||||
int64_t INT64_MAX
|
||||
uint8_t UINT8_MAX
|
||||
uint16_t UINT16_MAX
|
||||
uint32_t UINT32_MAX
|
||||
uint64_t UINT64_MAX
|
||||
#7.18.2.2 Limits of minimum-width integer types
|
||||
int_least8_t INT_LEAST8_MIN
|
||||
int_least16_t INT_LEAST16_MIN
|
||||
int_least32_t INT_LEAST32_MIN
|
||||
int_least64_t INT_LEAST64_MIN
|
||||
int_least8_t INT_LEAST8_MAX
|
||||
int_least16_t INT_LEAST16_MAX
|
||||
int_least32_t INT_LEAST32_MAX
|
||||
int_least64_t INT_LEAST64_MAX
|
||||
uint_least8_t UINT_LEAST8_MAX
|
||||
uint_least16_t UINT_LEAST16_MAX
|
||||
uint_least32_t UINT_LEAST32_MAX
|
||||
uint_least64_t UINT_LEAST64_MAX
|
||||
#7.18.2.3 Limits of fastest minimum-width integer types
|
||||
int_fast8_t INT_FAST8_MIN
|
||||
int_fast16_t INT_FAST16_MIN
|
||||
int_fast32_t INT_FAST32_MIN
|
||||
int_fast64_t INT_FAST64_MIN
|
||||
int_fast8_t INT_FAST8_MAX
|
||||
int_fast16_t INT_FAST16_MAX
|
||||
int_fast32_t INT_FAST32_MAX
|
||||
int_fast64_t INT_FAST64_MAX
|
||||
uint_fast8_t UINT_FAST8_MAX
|
||||
uint_fast16_t UINT_FAST16_MAX
|
||||
uint_fast32_t UINT_FAST32_MAX
|
||||
uint_fast64_t UINT_FAST64_MAX
|
||||
#7.18.2.4 Limits of integer types capable of holding object pointers
|
||||
enum: INTPTR_MIN
|
||||
enum: INTPTR_MAX
|
||||
enum: UINTPTR_MAX
|
||||
# 7.18.2.5 Limits of greatest-width integer types
|
||||
enum: INTMAX_MAX
|
||||
enum: INTMAX_MIN
|
||||
enum: UINTMAX_MAX
|
||||
|
||||
# 7.18.3 Limits of other integer types
|
||||
# ptrdiff_t
|
||||
enum: PTRDIFF_MIN
|
||||
enum: PTRDIFF_MAX
|
||||
# sig_atomic_t
|
||||
enum: SIG_ATOMIC_MIN
|
||||
enum: SIG_ATOMIC_MAX
|
||||
# size_t
|
||||
size_t SIZE_MAX
|
||||
# wchar_t
|
||||
enum: WCHAR_MIN
|
||||
enum: WCHAR_MAX
|
||||
# wint_t
|
||||
enum: WINT_MIN
|
||||
enum: WINT_MAX
|
|
@ -0,0 +1,80 @@
|
|||
# 7.19 Input/output <stdio.h>
|
||||
|
||||
|
||||
# deprecated cimports for backwards compatibility:
|
||||
from libc.string cimport const_char, const_void
|
||||
|
||||
|
||||
cdef extern from "<stdio.h>" nogil:
|
||||
|
||||
ctypedef struct FILE
|
||||
cdef FILE *stdin
|
||||
cdef FILE *stdout
|
||||
cdef FILE *stderr
|
||||
|
||||
enum: FOPEN_MAX
|
||||
enum: FILENAME_MAX
|
||||
FILE *fopen (const char *filename, const char *opentype)
|
||||
FILE *freopen (const char *filename, const char *opentype, FILE *stream)
|
||||
FILE *fdopen (int fdescriptor, const char *opentype)
|
||||
int fclose (FILE *stream)
|
||||
int remove (const char *filename)
|
||||
int rename (const char *oldname, const char *newname)
|
||||
FILE *tmpfile ()
|
||||
|
||||
int remove (const char *pathname)
|
||||
int rename (const char *oldpath, const char *newpath)
|
||||
|
||||
enum: _IOFBF
|
||||
enum: _IOLBF
|
||||
enum: _IONBF
|
||||
int setvbuf (FILE *stream, char *buf, int mode, size_t size)
|
||||
enum: BUFSIZ
|
||||
void setbuf (FILE *stream, char *buf)
|
||||
|
||||
size_t fread (void *data, size_t size, size_t count, FILE *stream)
|
||||
size_t fwrite (const void *data, size_t size, size_t count, FILE *stream)
|
||||
int fflush (FILE *stream)
|
||||
|
||||
enum: EOF
|
||||
void clearerr (FILE *stream)
|
||||
int feof (FILE *stream)
|
||||
int ferror (FILE *stream)
|
||||
|
||||
enum: SEEK_SET
|
||||
enum: SEEK_CUR
|
||||
enum: SEEK_END
|
||||
int fseek (FILE *stream, long int offset, int whence)
|
||||
void rewind (FILE *stream)
|
||||
long int ftell (FILE *stream)
|
||||
|
||||
ctypedef struct fpos_t
|
||||
ctypedef const fpos_t const_fpos_t "const fpos_t"
|
||||
int fgetpos (FILE *stream, fpos_t *position)
|
||||
int fsetpos (FILE *stream, const fpos_t *position)
|
||||
|
||||
int scanf (const char *template, ...)
|
||||
int sscanf (const char *s, const char *template, ...)
|
||||
int fscanf (FILE *stream, const char *template, ...)
|
||||
|
||||
int printf (const char *template, ...)
|
||||
int sprintf (char *s, const char *template, ...)
|
||||
int snprintf (char *s, size_t size, const char *template, ...)
|
||||
int fprintf (FILE *stream, const char *template, ...)
|
||||
|
||||
void perror (const char *message)
|
||||
|
||||
char *gets (char *s)
|
||||
char *fgets (char *s, int count, FILE *stream)
|
||||
int getchar ()
|
||||
int fgetc (FILE *stream)
|
||||
int getc (FILE *stream)
|
||||
int ungetc (int c, FILE *stream)
|
||||
|
||||
int puts (const char *s)
|
||||
int fputs (const char *s, FILE *stream)
|
||||
int putchar (int c)
|
||||
int fputc (int c, FILE *stream)
|
||||
int putc (int c, FILE *stream)
|
||||
|
||||
size_t getline(char **lineptr, size_t *n, FILE *stream)
|
|
@ -0,0 +1,72 @@
|
|||
# 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
|
|
@ -0,0 +1,50 @@
|
|||
# 7.21 String handling <string.h>
|
||||
|
||||
cdef extern from *:
|
||||
# deprecated backwards compatibility declarations
|
||||
ctypedef const char const_char "const char"
|
||||
ctypedef const signed char const_schar "const signed char"
|
||||
ctypedef const unsigned char const_uchar "const unsigned char"
|
||||
ctypedef const void const_void "const void"
|
||||
|
||||
cdef extern from "<string.h>" nogil:
|
||||
|
||||
void *memcpy (void *pto, const void *pfrom, size_t size)
|
||||
void *memmove (void *pto, const void *pfrom, size_t size)
|
||||
void *memset (void *block, int c, size_t size)
|
||||
int memcmp (const void *a1, const void *a2, size_t size)
|
||||
void *memchr (const void *block, int c, size_t size)
|
||||
|
||||
void *memchr (const void *block, int c, size_t size)
|
||||
void *memrchr (const void *block, int c, size_t size)
|
||||
|
||||
size_t strlen (const char *s)
|
||||
char *strcpy (char *pto, const char *pfrom)
|
||||
char *strncpy (char *pto, const char *pfrom, size_t size)
|
||||
char *strdup (const char *s)
|
||||
char *strndup (const char *s, size_t size)
|
||||
char *strcat (char *pto, const char *pfrom)
|
||||
char *strncat (char *pto, const char *pfrom, size_t size)
|
||||
|
||||
int strcmp (const char *s1, const char *s2)
|
||||
int strcasecmp (const char *s1, const char *s2)
|
||||
int strncmp (const char *s1, const char *s2, size_t size)
|
||||
int strncasecmp (const char *s1, const char *s2, size_t n)
|
||||
|
||||
int strcoll (const char *s1, const char *s2)
|
||||
size_t strxfrm (char *pto, const char *pfrom, size_t size)
|
||||
|
||||
char *strerror (int errnum)
|
||||
|
||||
char *strchr (const char *string, int c)
|
||||
char *strrchr (const char *string, int c)
|
||||
|
||||
char *strstr (const char *haystack, const char *needle)
|
||||
char *strcasestr (const char *haystack, const char *needle)
|
||||
|
||||
size_t strcspn (const char *string, const char *stopset)
|
||||
size_t strspn (const char *string, const char *set)
|
||||
char * strpbrk (const char *string, const char *stopset)
|
||||
|
||||
char *strtok (char *newstring, const char *delimiters)
|
||||
char *strsep (char **string_ptr, const char *delimiter)
|
|
@ -0,0 +1,46 @@
|
|||
# http://en.wikipedia.org/wiki/C_date_and_time_functions
|
||||
|
||||
from libc.stddef cimport wchar_t
|
||||
|
||||
cdef extern from "<time.h>" nogil:
|
||||
ctypedef long clock_t
|
||||
ctypedef long time_t
|
||||
|
||||
enum: CLOCKS_PER_SEC
|
||||
clock_t clock() # CPU time
|
||||
time_t time(time_t *) # wall clock time since Unix epoch
|
||||
|
||||
cdef struct tm:
|
||||
int tm_sec
|
||||
int tm_min
|
||||
int tm_hour
|
||||
int tm_mday
|
||||
int tm_mon
|
||||
int tm_year
|
||||
int tm_wday
|
||||
int tm_yday
|
||||
int tm_isdst
|
||||
char *tm_zone
|
||||
long tm_gmtoff
|
||||
|
||||
int daylight # global state
|
||||
long timezone
|
||||
char *tzname[2]
|
||||
void tzset()
|
||||
|
||||
char *asctime(const tm *)
|
||||
char *asctime_r(const tm *, char *)
|
||||
char *ctime(const time_t *)
|
||||
char *ctime_r(const time_t *, char *)
|
||||
double difftime(time_t, time_t)
|
||||
tm *getdate(const char *)
|
||||
tm *gmtime(const time_t *)
|
||||
tm *gmtime_r(const time_t *, tm *)
|
||||
tm *localtime(const time_t *)
|
||||
tm *localtime_r(const time_t *, tm *)
|
||||
time_t mktime(tm *)
|
||||
size_t strftime(char *, size_t, const char *, const tm *)
|
||||
size_t wcsftime(wchar_t *str, size_t cnt, const wchar_t *fmt, tm *time)
|
||||
|
||||
# POSIX not stdC
|
||||
char *strptime(const char *, const char *, tm *)
|
Loading…
Add table
Add a link
Reference in a new issue