diff --git a/LibC/ctype.h b/LibC/ctype.h index cfd0cbefec..c1282644bd 100644 --- a/LibC/ctype.h +++ b/LibC/ctype.h @@ -75,6 +75,11 @@ ALWAYS_INLINE int __isxdigit(int c) return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); } +ALWAYS_INLINE int __isgraph(int c) +{ + return __isalnum(c) || __ispunct(c); +} + #ifdef __cplusplus #define __CTYPE_FUNC(name) static inline int name(int c) { return __ ## name(c); } @@ -91,6 +96,7 @@ __CTYPE_FUNC(isalpha) __CTYPE_FUNC(isalnum) __CTYPE_FUNC(iscntrl) __CTYPE_FUNC(isxdigit) +__CTYPE_FUNC(isgraph) #else #define isascii(c) __isascii(c) #define isspace(c) __isspace(c) @@ -105,6 +111,7 @@ __CTYPE_FUNC(isxdigit) #define isalnum(c) __isalnum(c) #define iscntrl(c) __iscntrl(c) #define isxdigit(c) __isxdigit(c) +#define isgraph(c) __isgraph(c) #endif __END_DECLS diff --git a/LibC/errno_numbers.h b/LibC/errno_numbers.h index 2aa31f0aff..b441460a57 100644 --- a/LibC/errno_numbers.h +++ b/LibC/errno_numbers.h @@ -48,6 +48,29 @@ __ERROR(ENOTEMPTY, "Directory not empty") \ __ERROR(EDOM, "Math argument out of domain") \ __ERROR(ECONNREFUSED, "Connection refused") \ + __ERROR(EADDRNOTAVAIL, "Address not available") \ + __ERROR(EISCONN, "Already connected") \ + __ERROR(ECONNABORTED, "Connection aborted") \ + __ERROR(EALREADY, "Connection already in progress") \ + __ERROR(ECONNRESET, "Connection reset") \ + __ERROR(EDESTADDRREQ, "Desination address required") \ + __ERROR(EHOSTUNREACH, "Host unreachable") \ + __ERROR(EILSEQ, "Illegal byte sequence") \ + __ERROR(EMSGSIZE, "Message size") \ + __ERROR(ENETDOWN, "Network down") \ + __ERROR(ENETUNREACH, "Network unreachable") \ + __ERROR(ENETRESET, "Network reset") \ + __ERROR(ENOBUFS, "No buffer space") \ + __ERROR(ENOLCK, "No lock available") \ + __ERROR(ENOMSG, "No message") \ + __ERROR(ENOPROTOOPT, "No protocol option") \ + __ERROR(ENOTCONN, "Not connected") \ + __ERROR(EWOULDBLOCK, "Operation would block") \ + __ERROR(EPROTONOSUPPORT,"Protocol not supported") \ + __ERROR(EDEADLK, "Resource deadlock would occur") \ + __ERROR(ETIMEDOUT, "Timed out") \ + __ERROR(EPROTOTYPE, "Wrong protocol type") \ + __ERROR(EINPROGRESS, "Operation in progress") \ __ERROR(EMAXERRNO, "The highest errno +1 :^)") diff --git a/LibC/locale.h b/LibC/locale.h index 2d79ce935a..e7496e6470 100644 --- a/LibC/locale.h +++ b/LibC/locale.h @@ -2,6 +2,8 @@ #include +__BEGIN_DECLS + enum { LC_ALL, LC_NUMERIC, @@ -9,8 +11,10 @@ enum { LC_COLLATE, }; -__BEGIN_DECLS +struct lconv { +}; +struct lconv* localeconv(); char* setlocale(int category, const char* locale); __END_DECLS diff --git a/LibC/math.h b/LibC/math.h index 4012664033..9d416654ea 100644 --- a/LibC/math.h +++ b/LibC/math.h @@ -6,6 +6,51 @@ __BEGIN_DECLS #define HUGE_VAL 1e10000 +double acos(double); +float acosf(float); +double asin(double); +float asinf(float); +double atan(double); +float atanf(float); +double atan2(double, double); +float atan2f(float, float); +double cos(double); +float cosf(float); +double cosh(double); +float coshf(float); +double sin(double); +float sinf(float); +double sinh(double); +float sinhf(float); +double tan(double); +float tanf(float); +double tanh(double); +float tanhf(float); +double ceil(double); +float ceilf(float); +double floor(double); +float floorf(float); +double round(double); +float roundf(float); +double fabs(double); +float fabsf(float); +double fmod(double); +float fmodf(float); +double exp(double); +float expf(float); +double frexp(double, int* exp); +float frexpf(float, int* exp); +double log(double); +float logf(float); +double log10(double); +float log10f(float); +double sqrt(double); +float sqrtf(float); +double modf(double, double*); +float modff(float, float*); +double ldexp(double, int exp); +double ldexpf(float, int exp); + double pow(double x, double y); __END_DECLS diff --git a/LibC/stdint.h b/LibC/stdint.h index e2499208a1..ad56feaded 100644 --- a/LibC/stdint.h +++ b/LibC/stdint.h @@ -4,15 +4,25 @@ __BEGIN_DECLS -typedef unsigned long long int uint64_t; -typedef unsigned int uint32_t; -typedef unsigned short uint16_t; -typedef unsigned char uint8_t; +typedef __UINT64_TYPE__ uint64_t; +typedef __UINT32_TYPE__ uint32_t; +typedef __UINT16_TYPE__ uint16_t; +typedef __UINT8_TYPE__ uint8_t; -typedef signed long long int int64_t; -typedef signed int int32_t; -typedef signed short int16_t; -typedef signed char int8_t; +typedef __INT64_TYPE__ int64_t; +typedef __INT32_TYPE__ int32_t; +typedef __INT16_TYPE__ int16_t; +typedef __INT8_TYPE__ int8_t; + +typedef __UINT_FAST8_TYPE__ uint_fast8_t; +typedef __UINT_FAST16_TYPE__ uint_fast16_t; +typedef __UINT_FAST32_TYPE__ uint_fast32_t; +typedef __UINT_FAST64_TYPE__ uint_fast64_t; + +typedef __INT_FAST8_TYPE__ int_fast8_t; +typedef __INT_FAST16_TYPE__ int_fast16_t; +typedef __INT_FAST32_TYPE__ int_fast32_t; +typedef __INT_FAST64_TYPE__ int_fast64_t; #define __int8_t_defined 1 #define __uint8_t_defined 1 diff --git a/LibC/stdio.h b/LibC/stdio.h index a5cb1ce60e..54186cb784 100644 --- a/LibC/stdio.h +++ b/LibC/stdio.h @@ -37,6 +37,12 @@ extern FILE* stdin; extern FILE* stdout; extern FILE* stderr; +typedef size_t fpos_t; + +int fseek(FILE*, long offset, int whence); +int fgetpos(FILE*, fpos_t*); +int fsetpos(FILE*, const fpos_t*); +long ftell(FILE*); char* fgets(char* buffer, int size, FILE*); int fputc(int ch, FILE*); int fileno(FILE*); @@ -44,8 +50,9 @@ int fgetc(FILE*); int getc(FILE*); int getchar(); int ungetc(int c, FILE*); +int remove(const char* pathname); FILE* fdopen(int fd, const char* mode); -FILE* fopen(const char* pathname, const char* mode); +FILE* fopen(const char* pathname, const char* mode); FILE* freopen(const char* pathname, const char* mode, FILE*); int fclose(FILE*); void rewind(FILE*); void clearerr(FILE*); @@ -68,12 +75,14 @@ int putc(int ch, FILE*); int puts(const char*); int fputs(const char*, FILE*); void perror(const char*); -int sscanf (const char* buf, const char* fmt, ...); +int scanf(const char* fmt, ...); +int sscanf (const char* str, const char* fmt, ...); int fscanf(FILE*, const char* fmt, ...); int setvbuf(FILE*, char* buf, int mode, size_t); void setbuf(FILE*, char* buf); void setlinebuf(FILE*); int rename(const char* oldpath, const char* newpath); +FILE* tmpfile(); __END_DECLS diff --git a/LibC/stdlib.h b/LibC/stdlib.h index daa9d27c35..d36a99395c 100644 --- a/LibC/stdlib.h +++ b/LibC/stdlib.h @@ -16,14 +16,18 @@ void* realloc(void *ptr, size_t); char* getenv(const char* name); int atoi(const char*); long atol(const char*); +double strtod(const char*, char** endptr); long strtol(const char*, char** endptr, int base); unsigned long strtoul(const char*, char** endptr, int base); void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); +int atexit(void (*function)()); __attribute__((noreturn)) void exit(int status); __attribute__((noreturn)) void abort(); char* ptsname(int fd); int ptsname_r(int fd, char* buffer, size_t); int abs(int); +long labs(long); +double atof(const char*); int system(const char* command); char* mktemp(char*); void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); diff --git a/LibC/string.h b/LibC/string.h index bfeca32abc..4f168c39d1 100644 --- a/LibC/string.h +++ b/LibC/string.h @@ -29,6 +29,9 @@ size_t strcspn(const char*, const char* reject); char* strerror(int errnum); char* strsignal(int signum); char* strpbrk(const char*, const char* accept); +char *strtok(char* str, const char* delim); +int strcoll(const char *s1, const char *s2); +size_t strxfrm(char *dest, const char *src, size_t n); __END_DECLS diff --git a/LibC/time.h b/LibC/time.h index 2be49e0a85..b2a7d76d3f 100644 --- a/LibC/time.h +++ b/LibC/time.h @@ -30,10 +30,14 @@ extern int daylight; int gettimeofday(struct timeval*, struct timezone* tz); struct tm* localtime(const time_t*); struct tm *gmtime(const time_t*); +time_t mktime(struct tm*); time_t time(time_t*); char* ctime(const time_t*); void tzset(); char *asctime(const struct tm*); +clock_t clock(); +double difftime(time_t, time_t); +size_t strftime(char* s, size_t max, const char* format, const struct tm*); #define difftime(t1,t0) (double)(t1 - t0)