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
00055 #undef getc
00056 #undef putc
00057 #undef stdin
00058 #undef stdout
00059 #undef stderr
00060 #undef clearerr
00061 #undef feof
00062 #undef ferror
00063 #undef getchar
00064 #undef putchar
00065
00066 #include <stdio_nut_wrapper.h>
00067
00068 #endif
00069
00070 #endif
00071
00072 #ifndef _STDIO_H_
00073 #define _STDIO_H_
00074 #endif
00075
00076 #ifdef NO_STDIO_NUT_WRAPPER
00077
00078
00079 #else
00080
00081 #include <sys/types.h>
00082 #include <stdarg.h>
00083
00093
00094 #ifndef EOF
00095
00101 #define EOF (-1)
00102 #endif
00103
00104 #ifndef _IOFBF
00105 #define _IOFBF 0x00
00106 #define _IOLBF 0x01
00107 #define _IONBF 0x02
00108 #endif
00109
00119 typedef struct __iobuf FILE;
00120
00121 extern FILE *__iob[];
00123 #define stdin (__iob[0])
00124 #define stdout (__iob[1])
00125 #define stderr (__iob[2])
00128
00129 #ifndef SEEK_SET
00130 #define SEEK_SET 0
00131 #endif
00132
00133 #ifndef SEEK_CUR
00134 #define SEEK_CUR 1
00135 #endif
00136
00137 #ifndef SEEK_END
00138 #define SEEK_END 2
00139 #endif
00140
00141
00142 extern void clearerr(FILE * stream);
00143 extern int fclose(FILE * stream);
00144 extern void fcloseall(void);
00145 extern FILE *_fdopen(int fd, CONST char *mode);
00146 extern int feof(FILE * stream);
00147 extern int ferror(FILE * stream);
00148 extern int fflush(FILE * stream);
00149 extern int fgetc(FILE * stream);
00150 extern char *fgets(char *buffer, int count, FILE * stream);
00151 extern int _fileno(FILE * stream);
00152 extern void _flushall(void);
00153 extern FILE *fopen(CONST char *name, CONST char *mode);
00154 extern int fprintf(FILE * stream, CONST char *fmt, ...);
00155 extern int fpurge(FILE * stream);
00156 extern int fputc(int c, FILE * stream);
00157 extern int fputs(CONST char *string, FILE * stream);
00158 extern size_t fread(void *buffer, size_t size, size_t count, FILE * stream);
00159 extern FILE *freopen(CONST char *name, CONST char *mode, FILE * stream);
00160 extern int fscanf(FILE * stream, CONST char *fmt, ...);
00161 extern int fseek(FILE * stream, long offset, int origin);
00162 extern long ftell(FILE * stream);
00163 extern size_t fwrite(CONST void *data, size_t size, size_t count, FILE * stream);
00164 extern int getc(FILE * stream);
00165 extern int getchar(void);
00166 extern int kbhit(void);
00167 extern char *gets(char *buffer);
00168 extern int printf(CONST char *fmt, ...);
00169 extern int putc(int c, FILE * stream);
00170 extern int putchar(int c);
00171 extern int puts(CONST char *string);
00172 extern int scanf(CONST char *fmt, ...);
00173 extern int sprintf(char *buffer, CONST char *fmt, ...);
00174 extern int sscanf(CONST char *string, CONST char *fmt, ...);
00175 extern int ungetc(int c, FILE * stream);
00176 extern int vfprintf(FILE * stream, CONST char *fmt, va_list ap);
00177 extern int vfscanf(FILE * stream, CONST char *fmt, va_list ap);
00178 extern int vsprintf(char *buffer, CONST char *fmt, va_list ap);
00179 extern int vsscanf(CONST char *string, CONST char *fmt, va_list ap);
00180 extern int rename(CONST char *old_name, CONST char *new_name);
00181
00182 #ifdef __HARVARD_ARCH__
00183
00184 extern int fprintf_P(FILE * stream, PGM_P fmt, ...) __attribute__((format(printf, 2, 3)));
00185 extern int fputs_P(PGM_P string, FILE * stream);
00186 extern int fscanf_P(FILE * stream, PGM_P fmt, ...) __attribute__((format(scanf, 2, 3)));
00187 extern size_t fwrite_P(PGM_P data, size_t size, size_t count, FILE * stream);
00188 extern int printf_P(PGM_P fmt, ...) __attribute__((format(printf, 1, 2)));
00189 extern int puts_P(PGM_P string);
00190 extern int scanf_P(PGM_P fmt, ...) __attribute__((format(scanf, 1, 2)));
00191 extern int sprintf_P(char *buffer, PGM_P fmt, ...) __attribute__((format(printf, 2, 3)));
00192 extern int sscanf_P(CONST char *string, CONST char *fmt, ...) __attribute__((format(scanf, 2, 3)));
00193 extern int vfprintf_P(FILE * stream, PGM_P fmt, va_list ap);
00194 extern int vfscanf_P(FILE * stream, PGM_P fmt, va_list ap);
00195 extern int vsprintf_P(char *buffer, PGM_P fmt, va_list ap);
00196 extern int vsscanf_P(CONST char *string, PGM_P fmt, va_list ap);
00197
00198 #else
00199
00200 #if !defined(NUT_STDIO_PREFIXED)
00201
00202 #define fputs_P(string, stream) fputs(string, stream)
00203 #define fwrite_P(data, size, count, stream) fwrite(data, size, count, stream)
00204 #define puts_P(string) puts(string)
00205 #define vfprintf_P(stream, fmt, ap) vfprintf(stream, fmt, ap)
00206 #define vfscanf_P(stream, fmt, ap) vfscanf(stream, fmt, ap)
00207 #define vsprintf_P(buffer, fmt, ap) vsprintf(buffer, fmt, ap)
00208 #define vsscanf_P(string, fmt, ap) vsscanf(string, fmt, ap)
00209
00210 #if defined(__GNUC__)
00211 #define fprintf_P(...) fprintf(__VA_ARGS__)
00212 #define fscanf_P(...) fscanf(__VA_ARGS__)
00213 #define printf_P(...) printf(__VA_ARGS__)
00214 #define scanf_P(...) scanf(__VA_ARGS__)
00215 #define sprintf_P(...) sprintf(__VA_ARGS__)
00216 #define sscanf_P(...) sscanf(__VA_ARGS__)
00217 #else
00218 #define fprintf_P fprintf
00219 #define fscanf_P fscanf
00220 #define printf_P printf
00221 #define scanf_P scanf
00222 #define sprintf_P sprintf
00223 #define sscanf_P sscanf
00224 #endif
00225
00226 #endif
00227
00228 #endif
00229
00230 #endif
00231
00232 #endif
00233
00234 #endif