From e6248da18100235ae33468d058e5b71fcefeff3b Mon Sep 17 00:00:00 2001 From: Robert de Bath Date: Sun, 28 Jul 2002 22:10:50 +0200 Subject: Import Dev86src-0.16.6.tar.gz --- libc/include/asm/limits.h | 14 ++--- libc/include/stdio.h | 132 ---------------------------------------------- libc/stdio/Makefile | 2 +- libc/stdio/printf.c | 8 +-- libc/stdio/scanf.c | 8 +-- 5 files changed, 16 insertions(+), 148 deletions(-) delete mode 100644 libc/include/stdio.h (limited to 'libc') diff --git a/libc/include/asm/limits.h b/libc/include/asm/limits.h index 531ea41..25cf8b7 100644 --- a/libc/include/asm/limits.h +++ b/libc/include/asm/limits.h @@ -31,9 +31,9 @@ #define UINT_MAX 0xffff /* maximum unsigned int value */ #endif -/* BCC doesn't have signed char */ -/* #define SCHAR_MAX 127 /* maximum signed char value */ -/* #define SCHAR_MIN (-128) /* minimum signed char value */ +/* BCC does have signed char now. */ +#define SCHAR_MAX 127 /* maximum signed char value */ +#define SCHAR_MIN (-128) /* minimum signed char value */ #endif #if defined(__GNUC__) && defined(__i386__) @@ -46,12 +46,12 @@ #define UINT_MAX 0xffffffff /* maximum unsigned int value */ #endif -#ifndef INT_MAX -#error "Limits.h not fully implemented" -#endif - #ifndef RAND_MAX #define RAND_MAX INT_MAX #endif +#ifndef INT_MAX +#error "Limits.h not fully implemented, INT_MAX undefined!" +#endif + #endif diff --git a/libc/include/stdio.h b/libc/include/stdio.h deleted file mode 100644 index cbdacc3..0000000 --- a/libc/include/stdio.h +++ /dev/null @@ -1,132 +0,0 @@ - -#ifndef __STDIO_H -#define __STDIO_H - -#include -#include - -#ifndef SEEK_SET -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 -#endif - -#define _IOFBF 0x00 /* full buffering */ -#define _IOLBF 0x01 /* line buffering */ -#define _IONBF 0x02 /* no buffering */ -#define __MODE_BUF 0x03 /* Modal buffering dependent on isatty */ - -#define __MODE_FREEBUF 0x04 /* Buffer allocated with malloc, can free */ -#define __MODE_FREEFIL 0x08 /* FILE allocated with malloc, can free */ - -#define __MODE_READ 0x10 /* Opened in read only */ -#define __MODE_WRITE 0x20 /* Opened in write only */ -#define __MODE_RDWR 0x30 /* Opened in read/write */ - -#define __MODE_READING 0x40 /* Buffer has pending read data */ -#define __MODE_WRITING 0x80 /* Buffer has pending write data */ - -#define __MODE_EOF 0x100 /* EOF status */ -#define __MODE_ERR 0x200 /* Error status */ -#define __MODE_UNGOT 0x400 /* Buffer has been polluted by ungetc */ - -#ifdef __MSDOS__ -#define __MODE_IOTRAN 0x1000 /* MSDOS nl <-> cr,nl translation */ -#else -#define __MODE_IOTRAN 0 -#endif - -/* when you add or change fields here, be sure to change the initialization - * in stdio_init and fopen */ -struct __stdio_file { - unsigned char *bufpos; /* the next byte to write to or read from */ - unsigned char *bufread; /* the end of data returned by last read() */ - unsigned char *bufwrite; /* highest address writable by macro */ - unsigned char *bufstart; /* the start of the buffer */ - unsigned char *bufend; /* the end of the buffer; ie the byte after the last - malloc()ed byte */ - - int fd; /* the file descriptor associated with the stream */ - int mode; - - char unbuf[8]; /* The buffer for 'unbuffered' streams */ - - struct __stdio_file * next; -}; - -#define EOF (-1) -#ifndef NULL -#define NULL ((void*)0) -#endif - -typedef struct __stdio_file FILE; - -#ifdef __AS386_16__ -#define BUFSIZ (256) -#else -#define BUFSIZ (2048) -#endif - -extern FILE stdin[1]; -extern FILE stdout[1]; -extern FILE stderr[1]; - -#ifdef __MSDOS__ -#define putc(c, fp) fputc(c, fp) -#define getc(fp) fgetc(fp) -#else -#define putc(c, stream) \ - (((stream)->bufpos >= (stream)->bufwrite) ? fputc((c), (stream)) \ - : (unsigned char) (*(stream)->bufpos++ = (c)) ) - -#define getc(stream) \ - (((stream)->bufpos >= (stream)->bufread) ? fgetc(stream): \ - (*(stream)->bufpos++)) -#endif - -#define putchar(c) putc((c), stdout) -#define getchar() getc(stdin) - -#define ferror(fp) (((fp)->mode&__MODE_ERR) != 0) -#define feof(fp) (((fp)->mode&__MODE_EOF) != 0) -#define clearerr(fp) ((fp)->mode &= ~(__MODE_EOF|__MODE_ERR),0) -#define fileno(fp) ((fp)->fd) - -/* declare functions; not like it makes much difference without ANSI */ -/* RDB: The return values _are_ important, especially if we ever use - 8086 'large' model - */ - -/* These two call malloc */ -#define setlinebuf(__fp) setvbuf((__fp), (char*)0, _IOLBF, 0) -extern int setvbuf __P((FILE*, char*, int, size_t)); - -/* These don't */ -#define setbuf(__fp, __buf) setbuffer((__fp), (__buf), BUFSIZ) -extern void setbuffer __P((FILE*, char*, int)); - -extern int fgetc __P((FILE*)); -extern int fputc __P((int, FILE*)); - -extern int fclose __P((FILE*)); -extern int fflush __P((FILE*)); -extern char *fgets __P((char*, size_t, FILE*)); - -extern FILE *fopen __P((char*, char*)); -extern FILE *fdopen __P((int, char*)); -extern FILE *freopen __P((char*, char*, FILE*)); - -#ifdef __LIBC__ -extern FILE *__fopen __P((char*, int, FILE*, char*)); -#endif - -extern int fputs __P((char*, FILE*)); -extern int puts __P((char*)); - -extern int printf __P ((__const char*, ...)); -extern int fprintf __P ((FILE*, __const char*, ...)); -extern int sprintf __P ((char*, __const char*, ...)); - -#define stdio_pending(fp) ((fp)->bufread>(fp)->bufpos) - -#endif /* __STDIO_H */ diff --git a/libc/stdio/Makefile b/libc/stdio/Makefile index 9e96427..3c85f40 100644 --- a/libc/stdio/Makefile +++ b/libc/stdio/Makefile @@ -43,7 +43,7 @@ transfer: cp -p stdio.h ../include/. clean: - rm -f *.o libc.a + rm -f *.o libc.a ../include/stdio.h $(LIBC)($(OBJ)): stdio.h diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c index e41eca4..6e7b3e1 100644 --- a/libc/stdio/printf.c +++ b/libc/stdio/printf.c @@ -23,7 +23,7 @@ #include #include -#ifdef __STDC__ +#if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__) #include #define va_strt va_start #else @@ -35,7 +35,7 @@ #ifdef L_printf -#ifdef __STDC__ +#if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__) int printf(const char * fmt, ...) #else int printf(fmt, va_alist) @@ -53,7 +53,7 @@ va_dcl #endif #ifdef L_sprintf -#ifdef __STDC__ +#if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__) int sprintf(char * sp, const char * fmt, ...) #else int sprintf(sp, fmt, va_alist) @@ -80,7 +80,7 @@ static FILE string[1] = #endif #ifdef L_fprintf -#ifdef __STDC__ +#if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__) int fprintf(FILE * fp, const char * fmt, ...) #else int fprintf(fp, fmt, va_alist) diff --git a/libc/stdio/scanf.c b/libc/stdio/scanf.c index 1e0f282..a49174d 100644 --- a/libc/stdio/scanf.c +++ b/libc/stdio/scanf.c @@ -16,7 +16,7 @@ #include #include -#ifdef __STDC__ +#if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__) #include #define va_strt va_start #else @@ -25,7 +25,7 @@ #endif #ifdef L_scanf -#ifdef __STDC__ +#if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__) int scanf(const char * fmt, ...) #else int scanf(fmt, va_alist) @@ -43,7 +43,7 @@ va_dcl #endif #ifdef L_sscanf -#ifdef __STDC__ +#if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__) int sscanf(char * sp, const char * fmt, ...) #else int sscanf(sp, fmt, va_alist) @@ -69,7 +69,7 @@ static FILE string[1] = #endif #ifdef L_fscanf -#ifdef __STDC__ +#if defined(__STDC__) && !defined(__FIRST_ARG_IN_AX__) int fscanf(FILE * fp, const char * fmt, ...) #else int fscanf(fp, fmt, va_alist) -- cgit v1.2.1