2000-07-22 19:03:03 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* */
|
2013-05-09 11:56:54 +00:00
|
|
|
/* stdio.h */
|
2000-07-22 19:03:03 +00:00
|
|
|
/* */
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Input/output */
|
2000-07-22 19:03:03 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* */
|
2011-07-07 20:19:35 +00:00
|
|
|
/* (C) 1998-2011, Ullrich von Bassewitz */
|
2009-09-27 12:03:07 +00:00
|
|
|
/* Roemerstrasse 52 */
|
|
|
|
/* D-70794 Filderstadt */
|
|
|
|
/* EMail: uz@cc65.org */
|
2000-07-22 19:03:03 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* This software is provided 'as-is', without any expressed or implied */
|
|
|
|
/* warranty. In no event will the authors be held liable for any damages */
|
|
|
|
/* arising from the use of this software. */
|
|
|
|
/* */
|
|
|
|
/* Permission is granted to anyone to use this software for any purpose, */
|
|
|
|
/* including commercial applications, and to alter it and redistribute it */
|
|
|
|
/* freely, subject to the following restrictions: */
|
|
|
|
/* */
|
|
|
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
|
|
|
/* claim that you wrote the original software. If you use this software */
|
|
|
|
/* in a product, an acknowledgment in the product documentation would be */
|
|
|
|
/* appreciated but is not required. */
|
|
|
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
|
|
|
/* be misrepresented as being the original software. */
|
|
|
|
/* 3. This notice may not be removed or altered from any source */
|
|
|
|
/* distribution. */
|
|
|
|
/* */
|
|
|
|
/*****************************************************************************/
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _STDIO_H
|
|
|
|
#define _STDIO_H
|
|
|
|
|
|
|
|
|
2022-05-08 16:49:48 +00:00
|
|
|
/* NULL pointer */
|
2023-05-14 15:28:09 +00:00
|
|
|
#ifndef NULL
|
|
|
|
#define NULL ((void *) 0)
|
2022-05-08 16:49:48 +00:00
|
|
|
#endif
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2022-05-08 16:49:48 +00:00
|
|
|
/* size_t is needed */
|
|
|
|
#ifndef _HAVE_size_t
|
|
|
|
#define _HAVE_size_t
|
|
|
|
typedef unsigned size_t;
|
|
|
|
#endif
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2022-05-08 16:49:48 +00:00
|
|
|
/* stdio.h should not define va_list, so we use an equivalent type in the
|
|
|
|
compiler namespace instead */
|
|
|
|
typedef unsigned char* __va_list;
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
/* Types */
|
|
|
|
typedef struct _FILE FILE;
|
|
|
|
typedef unsigned long fpos_t;
|
|
|
|
|
|
|
|
/* Standard file descriptors */
|
|
|
|
extern FILE* stdin;
|
|
|
|
extern FILE* stdout;
|
|
|
|
extern FILE* stderr;
|
|
|
|
|
|
|
|
/* Standard defines */
|
2013-05-09 11:56:54 +00:00
|
|
|
#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
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2022-05-08 16:49:48 +00:00
|
|
|
/* These defines that are platform dependent */
|
|
|
|
/* FILENAME_MAX is defined as the same value as PATH_MAX in limits.h, but we
|
|
|
|
are not allowed to include limits.h here */
|
|
|
|
#if defined(__APPLE2__)
|
|
|
|
# define FILENAME_MAX (64+1)
|
|
|
|
#elif defined(__ATARI__)
|
|
|
|
# define FILENAME_MAX (63+1)
|
|
|
|
#elif defined(__CBM__)
|
|
|
|
# define FILENAME_MAX (255) /* should be 256+1, see libsrc/common/_cmd.s why it's not */
|
|
|
|
#elif defined(__LUNIX__)
|
|
|
|
# define FILENAME_MAX (80+1)
|
|
|
|
#elif defined(__TELESTRAT__)
|
|
|
|
# define FILENAME_MAX (50+1)
|
|
|
|
#else
|
|
|
|
# define FILENAME_MAX (16+1)
|
|
|
|
#endif
|
2004-03-21 22:10:42 +00:00
|
|
|
|
2022-05-08 16:49:48 +00:00
|
|
|
#define L_tmpnam FILENAME_MAX
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
2003-11-06 18:04:21 +00:00
|
|
|
/*****************************************************************************/
|
2013-05-09 11:56:54 +00:00
|
|
|
/* Code */
|
2003-11-06 18:04:21 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
/* Functions */
|
|
|
|
void __fastcall__ clearerr (FILE* f);
|
2002-11-25 14:37:52 +00:00
|
|
|
int __fastcall__ fclose (FILE* f);
|
2000-05-28 13:40:48 +00:00
|
|
|
int __fastcall__ feof (FILE* f);
|
|
|
|
int __fastcall__ ferror (FILE* f);
|
|
|
|
int __fastcall__ fflush (FILE* f);
|
2003-11-06 18:04:21 +00:00
|
|
|
int __fastcall__ fgetc (FILE* f);
|
|
|
|
char* __fastcall__ fgets (char* buf, size_t size, FILE* f);
|
2002-11-23 18:47:55 +00:00
|
|
|
FILE* __fastcall__ fopen (const char* name, const char* mode);
|
2000-05-28 13:40:48 +00:00
|
|
|
int fprintf (FILE* f, const char* format, ...);
|
2003-11-06 18:04:21 +00:00
|
|
|
int __fastcall__ fputc (int c, FILE* f);
|
2003-03-14 00:08:54 +00:00
|
|
|
int __fastcall__ fputs (const char* s, FILE* f);
|
2002-11-23 23:05:21 +00:00
|
|
|
size_t __fastcall__ fread (void* buf, size_t size, size_t count, FILE* f);
|
2003-11-06 18:04:21 +00:00
|
|
|
FILE* __fastcall__ freopen (const char* name, const char* mode, FILE* f);
|
2002-11-23 23:05:21 +00:00
|
|
|
size_t __fastcall__ fwrite (const void* buf, size_t size, size_t count, FILE* f);
|
2003-11-06 18:04:21 +00:00
|
|
|
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);
|
2011-07-07 20:19:35 +00:00
|
|
|
int getchar (void);
|
2003-11-06 18:04:21 +00:00
|
|
|
char* __fastcall__ gets (char* s);
|
2003-04-24 20:55:55 +00:00
|
|
|
void __fastcall__ perror (const char* s);
|
2000-05-28 13:40:48 +00:00
|
|
|
int printf (const char* format, ...);
|
2003-11-06 18:04:21 +00:00
|
|
|
int __fastcall__ putchar (int c);
|
|
|
|
int __fastcall__ puts (const char* s);
|
2003-06-02 16:11:38 +00:00
|
|
|
int __fastcall__ remove (const char* name);
|
2003-08-12 12:54:39 +00:00
|
|
|
int __fastcall__ rename (const char* oldname, const char* newname);
|
2009-09-27 12:03:07 +00:00
|
|
|
int snprintf (char* buf, size_t size, const char* format, ...);
|
2000-05-28 13:40:48 +00:00
|
|
|
int sprintf (char* buf, const char* format, ...);
|
2004-05-14 20:58:37 +00:00
|
|
|
int __fastcall__ ungetc (int c, FILE* f);
|
2022-05-08 16:49:48 +00:00
|
|
|
int __fastcall__ vfprintf (FILE* f, 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);
|
2000-05-28 13:40:48 +00:00
|
|
|
|
2002-03-17 17:18:19 +00:00
|
|
|
int scanf (const char* format, ...);
|
|
|
|
int fscanf (FILE* f, const char* format, ...);
|
|
|
|
int sscanf (const char* s, const char* format, ...);
|
2022-05-08 16:49:48 +00:00
|
|
|
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);
|
2002-03-17 17:18:19 +00:00
|
|
|
|
2004-06-21 22:22:11 +00:00
|
|
|
#if __CC65_STD__ == __CC65_STD_CC65__
|
2013-05-09 11:56:54 +00:00
|
|
|
FILE* __fastcall__ fdopen (int fd, const char* mode); /* Unix */
|
|
|
|
int __fastcall__ fileno (FILE* f); /* Unix */
|
2000-05-28 13:40:48 +00:00
|
|
|
#endif
|
2022-08-29 19:06:48 +00:00
|
|
|
void __fastcall__ __poserror (const char* msg); /* cc65 */
|
|
|
|
#if __CC65_STD__ == __CC65_STD_CC65__
|
|
|
|
/* define old name with one underscore for backwards compatibility */
|
|
|
|
#define _poserror __poserror
|
|
|
|
#endif
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
/* Masking macros for some functions */
|
2013-05-09 11:56:54 +00:00
|
|
|
#define getc(f) fgetc (f) /* ANSI */
|
|
|
|
#define putc(c, f) fputc (c, f) /* ANSI */
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* End of stdio.h */
|
|
|
|
#endif
|