X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fstdio.h;h=c2c735cb017f8190471ae805f39a2a7015330cb5;hb=5bf8523dcd61f140e7ed5921e529a1b75c9b471b;hp=02f482159ae1d953e7b46023690f39153bda75ee;hpb=5f812a3269eeabda2bdb0668b22a1eede4897696;p=cc65 diff --git a/include/stdio.h b/include/stdio.h index 02f482159..c2c735cb0 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,15 +1,15 @@ /*****************************************************************************/ /* */ -/* stdio.h */ +/* stdio.h */ /* */ -/* Input/output */ +/* Input/output */ /* */ /* */ /* */ -/* (C) 1998-2002 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 1998-2011, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -57,18 +57,34 @@ extern FILE* stdout; extern FILE* stderr; /* Standard defines */ -#define _IOFBF 0 -#define _IOLBF 1 -#define _IONBF 2 -#define BUFSIZ 256 -#define EOF -1 -#define FILENAME_MAX 16 -#define FOPEN_MAX 8 -#define L_tmpnam (FILENAME_MAX + 1) -#define SEEK_CUR 0 -#define SEEK_END 1 -#define SEEK_SET 2 -#define TMP_MAX 256 +#define _IOFBF 0 +#define _IOLBF 1 +#define _IONBF 2 +#define BUFSIZ 256 +#define EOF -1 +#define FOPEN_MAX 8 +#define SEEK_CUR 0 +#define SEEK_END 1 +#define SEEK_SET 2 +#define TMP_MAX 256 + +/* Standard defines that are platform dependent */ +#if defined(__APPLE2__) +# define FILENAME_MAX (64+1) +#elif defined(__ATARI__) +# define FILENAME_MAX (12+1) +#elif defined(__LUNIX__) +# define FILENAME_MAX (80+1) +#else +# define FILENAME_MAX (16+1) +#endif +#define L_tmpnam FILENAME_MAX + + + +/*****************************************************************************/ +/* Code */ +/*****************************************************************************/ @@ -78,58 +94,52 @@ int __fastcall__ fclose (FILE* f); int __fastcall__ feof (FILE* f); int __fastcall__ ferror (FILE* f); int __fastcall__ fflush (FILE* f); -int fgetc (FILE* f); -char* fgets (char* buf, size_t size, FILE* f); +int __fastcall__ fgetc (FILE* f); +char* __fastcall__ fgets (char* buf, size_t size, FILE* f); FILE* __fastcall__ fopen (const char* name, const char* mode); int fprintf (FILE* f, const char* format, ...); -int fputc (int c, FILE* f); -int fputs (const char* s, FILE* f); +int __fastcall__ fputc (int c, FILE* f); +int __fastcall__ fputs (const char* s, FILE* f); size_t __fastcall__ fread (void* buf, size_t size, size_t count, FILE* f); -FILE* freopen (const char* name, const char* mode, FILE* f); +FILE* __fastcall__ freopen (const char* name, const char* mode, FILE* f); size_t __fastcall__ fwrite (const void* buf, size_t size, size_t count, FILE* f); -int fgetpos(FILE* f, fpos_t *pos); -int fsetpos(FILE* f, const fpos_t* pos); -long ftell(FILE* f); -int fseek(FILE* f, long offset, int whence); -void rewind(FILE *f); +int __fastcall__ fgetpos (FILE* f, fpos_t *pos); +int __fastcall__ fsetpos (FILE* f, const fpos_t* pos); +long __fastcall__ ftell (FILE* f); +int __fastcall__ fseek (FILE* f, long offset, int whence); +void __fastcall__ rewind (FILE *f); int getchar (void); -char* gets (char* s); -void perror (const char* s); +char* __fastcall__ gets (char* s); +void __fastcall__ perror (const char* s); int printf (const char* format, ...); -int putchar (int c); -int puts (const char* s); -int remove (const char* name); -int rename (const char* old, const char* new); +int __fastcall__ putchar (int c); +int __fastcall__ puts (const char* s); +int __fastcall__ remove (const char* name); +int __fastcall__ rename (const char* oldname, const char* newname); +int snprintf (char* buf, size_t size, const char* format, ...); int sprintf (char* buf, const char* format, ...); +int __fastcall__ ungetc (int c, FILE* f); int __fastcall__ vfprintf (FILE* f, const char* format, va_list ap); -int vprintf (const char* format, va_list ap); +int __fastcall__ vprintf (const char* format, va_list ap); +int __fastcall__ vsnprintf (char* buf, size_t size, const char* format, va_list ap); int __fastcall__ vsprintf (char* buf, const char* format, va_list ap); -/* Not available or testing: */ int scanf (const char* format, ...); int fscanf (FILE* f, const char* format, ...); int sscanf (const char* s, const char* format, ...); -int vscanf (const char* format, va_list ap); -int vsscanf (const char* s, const char* format, va_list ap); -int vfscanf (FILE* f, const char* format, va_list ap); +int __fastcall__ vscanf (const char* format, va_list ap); +int __fastcall__ vsscanf (const char* s, const char* format, va_list ap); +int __fastcall__ vfscanf (FILE* f, const char* format, va_list ap); -#ifndef __STRICT_ANSI__ -FILE* fdopen (int fd, const char* mode); /* Unix */ -int __fastcall__ fileno (FILE* f); /* Unix */ +#if __CC65_STD__ == __CC65_STD_CC65__ +FILE* __fastcall__ fdopen (int fd, const char* mode); /* Unix */ +int __fastcall__ fileno (FILE* f); /* Unix */ #endif - +void __fastcall__ _poserror (const char* msg); /* cc65 */ /* Masking macros for some functions */ -#define getchar() fgetc (stdin) /* ANSI */ -#define putchar(c) fputc (c, stdout) /* ANSI */ -#define getc(f) fgetc (f) /* ANSI */ -#define putc(c, f) fputc (c, f) /* ANSI */ - -/* Non-standard function like macros */ -#ifndef __STRICT_ANSI__ -#define flushall() /* Unix */ -#define unlink(name) remove (name) /* Unix */ -#endif +#define getc(f) fgetc (f) /* ANSI */ +#define putc(c, f) fputc (c, f) /* ANSI */