From bb2dd23f315bafa7b0b64845c2fe25d7a0893b10 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sat, 16 Jul 2016 18:07:24 +0200 Subject: Got Lua running \o/ --- src/lib/include/setjmp.h | 5 +---- src/lib/include/stdio.h | 26 +++++++++++++++----------- 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/lib/include') diff --git a/src/lib/include/setjmp.h b/src/lib/include/setjmp.h index 46c3b5d..904ae4a 100644 --- a/src/lib/include/setjmp.h +++ b/src/lib/include/setjmp.h @@ -2,10 +2,7 @@ #include -struct _jmp_buf { - uint32_t stuff[10]; // 40 bytes -}; -typedef struct _jmp_buf jmp_buf; +typedef uint32_t jmp_buf[10]; int setjmp(jmp_buf env); diff --git a/src/lib/include/stdio.h b/src/lib/include/stdio.h index c6b636d..a67553c 100644 --- a/src/lib/include/stdio.h +++ b/src/lib/include/stdio.h @@ -2,6 +2,8 @@ #include +#include + #include #include @@ -11,7 +13,10 @@ void setup_libc_stdio(); //TODO below struct file_t { - // TODO + fd_t fd; + stat_t st; + int mode; + int flags; }; typedef struct file_t FILE; @@ -47,15 +52,15 @@ int fclose(FILE* f); extern FILE *stdin, *stdout, *stderr; -#define BUFSIZ 0 +#define BUFSIZ 1024 void setbuf(FILE *stream, char *buf); void setbuffer(FILE *stream, char *buf, size_t size); void setlinebuf(FILE *stream); int setvbuf(FILE *stream, char *buf, int mode, size_t size); -#define _IOFBF 0 -#define _IOLBF 1 -#define _IONBF 2 +#define _IOFBF 1 +#define _IOLBF 2 +#define _IONBF 4 typedef size_t fpos_t; //TODO @@ -65,9 +70,9 @@ void rewind(FILE *stream); int fgetpos(FILE *stream, fpos_t *pos); int fsetpos(FILE *stream, const fpos_t *pos); -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 +#define SEEK_SET 1 +#define SEEK_CUR 2 +#define SEEK_END 4 #define L_tmpnam 128 FILE *tmpfile(void); @@ -76,11 +81,10 @@ char *tmpnam(char *s); int rename(const char *old, const char *new); int remove(const char *pathname); - int printf(const char *format, ...); int fprintf(FILE *stream, const char *format, ...); -int dprintf(int fd, const char *format, ...); -int sprintf(char *str, const char *format, ...); +int vfprintf(FILE *stream, const char *format, va_list ap); + /* vim: set ts=4 sw=4 tw=0 noet :*/ -- cgit v1.2.3