00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef _STDIO_H_
00041
00042 #ifndef _STDIO_VIRTUAL_H_
00043 #define _STDIO_VIRTUAL_H_
00044
00045 #ifdef __NUT_EMULATION__
00046
00047
00048 #include "stdio_orig.h"
00049
00050
00051
00052
00053 #ifndef NO_STDIO_NUT_WRAPPER
00054 #undef getc
00055 #undef putc
00056 #undef stdin
00057 #undef stdout
00058 #undef stderr
00059 #undef clearerr
00060 #undef feof
00061 #undef ferror
00062 #undef getchar
00063 #undef putchar
00064
00065 #include <stdio_nut_wrapper.h>
00066
00067 #endif
00068
00069 #endif
00070
00071 #ifndef _STDIO_H_
00072 #define _STDIO_H_
00073 #endif
00074
00075 #ifdef NO_STDIO_NUT_WRAPPER
00076
00077
00078 #else
00079
00080 #include <sys/types.h>
00081 #include <stdarg.h>
00082
00092
00093 #ifndef EOF
00094
00100 #define EOF (-1)
00101 #endif
00102
00103 #ifndef _IOFBF
00104 #define _IOFBF 0x00
00105 #define _IOLBF 0x01
00106 #define _IONBF 0x02
00107 #endif
00108
00118 typedef struct __iobuf FILE;
00119
00120 extern FILE *__iob[];
00122 #define stdin (__iob[0])
00123 #define stdout (__iob[1])
00124 #define stderr (__iob[2])
00127
00128 #ifndef SEEK_SET
00129 #define SEEK_SET 0
00130 #endif
00131
00132 #ifndef SEEK_CUR
00133 #define SEEK_CUR 1
00134 #endif
00135
00136 #ifndef SEEK_END
00137 #define SEEK_END 2
00138 #endif
00139
00140 extern void clearerr(FILE * stream);
00141 extern int fclose(FILE * stream);
00142 extern void fcloseall(void);
00143 extern FILE *_fdopen(int fd, CONST char *mode);
00144 extern int feof(FILE * stream);
00145 extern int ferror(FILE * stream);
00146 extern int fflush(FILE * stream);
00147 extern int fgetc(FILE * stream);
00148 extern char *fgets(char *buffer, int count, FILE * stream);
00149 extern int _fileno(FILE * stream);
00150 extern void _flushall(void);
00151 extern FILE *fopen(CONST char *name, CONST char *mode);
00152 extern int fprintf(FILE * stream, CONST char *fmt, ...);
00153 extern int fpurge(FILE * stream);
00154 extern int fputc(int c, FILE * stream);
00155 extern int fputs(CONST char *string, FILE * stream);
00156 extern size_t fread(void *buffer, size_t size, size_t count, FILE * stream);
00157 extern FILE *freopen(CONST char *name, CONST char *mode, FILE * stream);
00158 extern int fscanf(FILE * stream, CONST char *fmt, ...);
00159 extern int fseek(FILE * stream, long offset, int origin);
00160 extern long ftell(FILE * stream);
00161 extern size_t fwrite(CONST void *data, size_t size, size_t count, FILE * stream);
00162 extern int getc(FILE * stream);
00163 extern int getchar(void);
00164 extern int kbhit(void);
00165 extern char *gets(char *buffer);
00166 extern int printf(CONST char *fmt, ...);
00167 extern int putc(int c, FILE * stream);
00168 extern int putchar(int c);
00169 extern int puts(CONST char *string);
00170 extern int scanf(CONST char *fmt, ...);
00171 extern int sprintf(char *buffer, CONST char *fmt, ...);
00172 extern int sscanf(CONST char *string, CONST char *fmt, ...);
00173 extern int ungetc(int c, FILE * stream);
00174 extern int vfprintf(FILE * stream, CONST char *fmt, va_list ap);
00175 extern int vfscanf(FILE * stream, CONST char *fmt, va_list ap);
00176 extern int vsprintf(char *buffer, CONST char *fmt, va_list ap);
00177 extern int vsscanf(CONST char *string, CONST char *fmt, va_list ap);
00178 extern int rename(CONST char *old_name, CONST char *new_name);
00179
00180 #ifdef __HARVARD_ARCH__
00181
00182 extern int fprintf_P(FILE * stream, PGM_P fmt, ...) __attribute__((format(printf, 2, 3)));
00183 extern int fputs_P(PGM_P string, FILE * stream);
00184 extern int fscanf_P(FILE * stream, PGM_P fmt, ...) __attribute__((format(scanf, 2, 3)));
00185 extern size_t fwrite_P(PGM_P data, size_t size, size_t count, FILE * stream);
00186 extern int printf_P(PGM_P fmt, ...) __attribute__((format(printf, 1, 2)));
00187 extern int puts_P(PGM_P string);
00188 extern int scanf_P(PGM_P fmt, ...) __attribute__((format(scanf, 1, 2)));
00189 extern int sprintf_P(char *buffer, PGM_P fmt, ...) __attribute__((format(printf, 2, 3)));
00190 extern int sscanf_P(CONST char *string, CONST char *fmt, ...) __attribute__((format(scanf, 2, 3)));
00191 extern int vfprintf_P(FILE * stream, PGM_P fmt, va_list ap);
00192 extern int vfscanf_P(FILE * stream, PGM_P fmt, va_list ap);
00193 extern int vsprintf_P(char *buffer, PGM_P fmt, va_list ap);
00194 extern int vsscanf_P(CONST char *string, PGM_P fmt, va_list ap);
00195
00196 #else
00197
00198 #if !defined(NUT_STDIO_PREFIXED)
00199
00200 #define fputs_P(string, stream) fputs(string, stream)
00201 #define fwrite_P(data, size, count, stream) fwrite(data, size, count, stream)
00202 #define puts_P(string) puts(string)
00203 #define vfprintf_P(stream, fmt, ap) vfprintf(stream, fmt, ap)
00204 #define vfscanf_P(stream, fmt, ap) vfscanf(stream, fmt, ap)
00205 #define vsprintf_P(buffer, fmt, ap) vsprintf(buffer, fmt, ap)
00206 #define vsscanf_P(string, fmt, ap) vsscanf(string, fmt, ap)
00207
00208 #if defined(__GNUC__)
00209 #define fprintf_P(...) fprintf(__VA_ARGS__)
00210 #define fscanf_P(...) fscanf(__VA_ARGS__)
00211 #define printf_P(...) printf(__VA_ARGS__)
00212 #define scanf_P(...) scanf(__VA_ARGS__)
00213 #define sprintf_P(...) sprintf(__VA_ARGS__)
00214 #define sscanf_P(...) sscanf(__VA_ARGS__)
00215 #else
00216 #define fprintf_P fprintf
00217 #define fscanf_P fscanf
00218 #define printf_P printf
00219 #define scanf_P scanf
00220 #define sprintf_P sprintf
00221 #define sscanf_P sscanf
00222 #endif
00223
00224 #endif
00225
00226 #endif
00227
00228 #endif
00229
00230 #endif
00231
00232 #endif