From b23d7a293010c9c31845bbc308bcf0df9bb25984 Mon Sep 17 00:00:00 2001 From: "K. Lange" Date: Wed, 9 May 2018 17:02:31 +0900 Subject: [PATCH] some stuff to get further in python builds --- base/usr/include/ctype.h | 3 +++ base/usr/include/math.h | 2 ++ base/usr/include/stdio.h | 3 +++ libc/ctype/tolower.c | 6 ++++++ libc/ctype/toupper.c | 7 +++++++ libc/stdio/stdio.c | 4 ++++ 6 files changed, 25 insertions(+) create mode 100644 libc/ctype/tolower.c create mode 100644 libc/ctype/toupper.c diff --git a/base/usr/include/ctype.h b/base/usr/include/ctype.h index e650fd3d..4604c86c 100644 --- a/base/usr/include/ctype.h +++ b/base/usr/include/ctype.h @@ -13,3 +13,6 @@ extern int isupper(int c); extern int isxdigit(int c); extern int isascii(int c); + +extern int tolower(int c); +extern int toupper(int c); diff --git a/base/usr/include/math.h b/base/usr/include/math.h index 4d0b89f5..5b31ff99 100644 --- a/base/usr/include/math.h +++ b/base/usr/include/math.h @@ -9,3 +9,5 @@ extern double sqrt(double x); extern double fabs(double x); extern double sin(double x); extern double cos(double x); + +#define HUGE_VAL (__builtin_huge_val()) diff --git a/base/usr/include/stdio.h b/base/usr/include/stdio.h index c421d7bc..e4675ce0 100644 --- a/base/usr/include/stdio.h +++ b/base/usr/include/stdio.h @@ -48,3 +48,6 @@ extern void perror(const char *s); extern int ungetc(int c, FILE * stream); extern int feof(FILE * stream); +extern void clearerr(FILE * stream); + +#define getc(s) fgetc(s) diff --git a/libc/ctype/tolower.c b/libc/ctype/tolower.c new file mode 100644 index 00000000..576516ac --- /dev/null +++ b/libc/ctype/tolower.c @@ -0,0 +1,6 @@ +int tolower(int c) { + if (c >= 'A' && c <= 'Z') { + return c - 'A' + 'a'; + } + return c; +} diff --git a/libc/ctype/toupper.c b/libc/ctype/toupper.c new file mode 100644 index 00000000..8af6fc39 --- /dev/null +++ b/libc/ctype/toupper.c @@ -0,0 +1,7 @@ +int toupper(int c) { + if (c >= 'a' && c <= 'z') { + return c - 'a' + 'A'; + } + return c; +} + diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c index ec65df96..f9fec650 100644 --- a/libc/stdio/stdio.c +++ b/libc/stdio/stdio.c @@ -331,3 +331,7 @@ void setbuf(FILE * stream, char * buf) { int feof(FILE * stream) { return stream->eof; } + +void clearerr(FILE * stream) { + stream->eof = 0; +}