]> git.sur5r.net Git - cc65/blob - include/stdio.h
Make fread and fwrite fastcall
[cc65] / include / stdio.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                  stdio.h                                  */
4 /*                                                                           */
5 /*                               Input/output                                */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 1998-2002 Ullrich von Bassewitz                                       */
10 /*               Wacholderweg 14                                             */
11 /*               D-70597 Stuttgart                                           */
12 /* EMail:        uz@musoftware.de                                            */
13 /*                                                                           */
14 /*                                                                           */
15 /* This software is provided 'as-is', without any expressed or implied       */
16 /* warranty.  In no event will the authors be held liable for any damages    */
17 /* arising from the use of this software.                                    */
18 /*                                                                           */
19 /* Permission is granted to anyone to use this software for any purpose,     */
20 /* including commercial applications, and to alter it and redistribute it    */
21 /* freely, subject to the following restrictions:                            */
22 /*                                                                           */
23 /* 1. The origin of this software must not be misrepresented; you must not   */
24 /*    claim that you wrote the original software. If you use this software   */
25 /*    in a product, an acknowledgment in the product documentation would be  */
26 /*    appreciated but is not required.                                       */
27 /* 2. Altered source versions must be plainly marked as such, and must not   */
28 /*    be misrepresented as being the original software.                      */
29 /* 3. This notice may not be removed or altered from any source              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 #ifndef _STDIO_H
37 #define _STDIO_H
38
39
40
41 #ifndef _STDDEF_H
42 #  include <stddef.h>
43 #endif
44 #ifndef _STDARG_H
45 #  include <stdarg.h>
46 #endif
47
48
49
50 /* Types */
51 typedef struct _FILE FILE;
52 typedef unsigned long fpos_t;
53
54 /* Standard file descriptors */
55 extern FILE* stdin;
56 extern FILE* stdout;
57 extern FILE* stderr;
58
59 /* Standard defines */
60 #define _IOFBF          0
61 #define _IOLBF          1
62 #define _IONBF          2
63 #define BUFSIZ          256
64 #define EOF             -1
65 #define FILENAME_MAX    16
66 #define FOPEN_MAX       8
67 #define L_tmpnam        (FILENAME_MAX + 1)
68 #define SEEK_CUR        0
69 #define SEEK_END        1
70 #define SEEK_SET        2
71 #define TMP_MAX         256
72
73
74
75 /* Functions */
76 void __fastcall__ clearerr (FILE* f);
77 int fclose (FILE* f);
78 int __fastcall__ feof (FILE* f);
79 int __fastcall__ ferror (FILE* f);
80 int __fastcall__ fflush (FILE* f);
81 int fgetc (FILE* f);
82 char* fgets (char* buf, size_t size, FILE* f);
83 FILE* __fastcall__ fopen (const char* name, const char* mode);
84 int fprintf (FILE* f, const char* format, ...);
85 int fputc (int c, FILE* f);
86 int fputs (const char* s, FILE* f);
87 size_t __fastcall__ fread (void* buf, size_t size, size_t count, FILE* f);
88 FILE* freopen (const char* name, const char* mode, FILE* f);
89 size_t __fastcall__ fwrite (const void* buf, size_t size, size_t count, FILE* f);
90 int fgetpos(FILE* f, fpos_t *pos);
91 int fsetpos(FILE* f, const fpos_t* pos);
92 long ftell(FILE* f);
93 int fseek(FILE* f, long offset, int whence);
94 void rewind(FILE *f);
95 int getchar (void);
96 char* gets (char* s);
97 void perror (const char* s);
98 int printf (const char* format, ...);
99 int putchar (int c);
100 int puts (const char* s);
101 int remove (const char* name);
102 int rename (const char* old, const char* new);
103 int sprintf (char* buf, const char* format, ...);
104 int __fastcall__ vfprintf (FILE* f, const char* format, va_list ap);
105 int vprintf (const char* format, va_list ap);
106 int __fastcall__ vsprintf (char* buf, const char* format, va_list ap);
107
108 /* Not available or testing: */
109 int scanf (const char* format, ...);
110 int fscanf (FILE* f, const char* format, ...);
111 int sscanf (const char* s, const char* format, ...);
112 int vscanf (const char* format, va_list ap);
113 int vsscanf (const char* s, const char* format, va_list ap);
114 int vfscanf (FILE* f, const char* format, va_list ap);
115
116 #ifndef __STRICT_ANSI__
117 FILE* fdopen (int fd, const char* mode);        /* Unix */
118 int __fastcall__ fileno (FILE* f);              /* Unix */
119 #endif
120
121
122 /* Masking macros for some functions */
123 #define getchar()       fgetc (stdin)           /* ANSI */
124 #define putchar(c)      fputc (c, stdout)       /* ANSI */
125 #define getc(f)         fgetc (f)               /* ANSI */
126 #define putc(c, f)      fputc (c, f)            /* ANSI */
127
128 /* Non-standard function like macros */
129 #ifndef __STRICT_ANSI__
130 #define flushall()                              /* Unix */
131 #define unlink(name)    remove (name)           /* Unix */
132 #endif
133
134
135
136 /* End of stdio.h */
137 #endif
138
139
140