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
00041
00042 #ifndef _STDIO_H_
00043 #define _STDIO_H_
00044
00045 #ifdef __cplusplus
00046 extern "C" {
00047 #endif
00048
00049 #include <sys/cdefs.h>
00050 #include <sys/_null.h>
00051 #include <sys/_types.h>
00052
00053 #ifdef __SYMBIAN32__
00054 #include <_ansi.h>
00055 #endif
00056
00057
00058
00059 typedef __off_t fpos_t;
00060
00061 #ifndef _SIZE_T_DECLARED
00062 typedef __size_t size_t;
00063 #define _SIZE_T_DECLARED
00064 #endif
00065
00066 #ifndef __SYMBIAN32__
00067 #if (__BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE) && !__SYMBIAN32__
00068 #ifndef _VA_LIST_DECLARED
00069 typedef __va_list va_list;
00070 #define va_list __e32_va_list
00071 #define _VA_LIST_DECLARED
00072 #endif
00073 #endif
00074 #else //__SYMBIAN32__
00075 #include <stdarg_e.h>
00076 #include <stdarg.h>
00077
00078 #endif
00079
00080 #ifdef __SYMBIAN32__
00081 #define vfscanf __vfscanf
00082 #ifndef _VA_COPY_DEFINED
00083 #define va_copy(dst,src) (dst = src)
00084 #define _VA_COPY_DEFINED
00085
00086 #endif
00087
00088 #endif
00089 #define _FSTDIO
00090
00091
00092
00093
00094
00095
00096
00097
00098 struct __sbuf {
00099 unsigned char *_base;
00100 int _size;
00101 };
00102
00103
00104 struct __sFILEX;
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 typedef struct __sFILE {
00131 unsigned char *_p;
00132 int _r;
00133 int _w;
00134 short _flags;
00135 short _file;
00136 struct __sbuf _bf;
00137 int _lbfsize;
00138
00139
00140 void *_cookie;
00141 int (*_close)(void *);
00142 int (*_read)(void *, char *, int);
00143 fpos_t (*_seek)(void *, fpos_t, int);
00144 int (*_write)(void *, const char *, int);
00145
00146
00147 struct __sbuf _ub;
00148 struct __sFILEX *_extra;
00149 int _ur;
00150
00151
00152 unsigned char _ubuf[3];
00153 unsigned char _nbuf[1];
00154
00155
00156 struct __sbuf _lb;
00157
00158
00159 int _blksize;
00160 fpos_t _offset;
00161 } FILE;
00162
00163 #ifndef _STDSTREAM_DECLARED
00164 __BEGIN_DECLS
00165 #if (!defined(__SYMBIAN32__) && (!defined(__WINSCW__) || !defined(__WINS__)))
00166 extern FILE *__stdinp;
00167 extern FILE *__stdoutp;
00168 extern FILE *__stderrp;
00169
00170 #endif
00171 __END_DECLS
00172 #define _STDSTREAM_DECLARED
00173 #endif
00174
00175 #define __SLBF 0x0001
00176 #define __SNBF 0x0002
00177 #define __SRD 0x0004
00178 #define __SWR 0x0008
00179
00180 #define __SRW 0x0010
00181 #define __SEOF 0x0020
00182 #define __SERR 0x0040
00183 #define __SMBF 0x0080
00184 #define __SAPP 0x0100
00185 #define __SSTR 0x0200
00186 #define __SOPT 0x0400
00187 #define __SNPT 0x0800
00188 #define __SOFF 0x1000
00189 #define __SMOD 0x2000
00190 #define __SALC 0x4000
00191 #define __SIGN 0x8000
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202 #define _IOFBF 0
00203 #define _IOLBF 1
00204 #define _IONBF 2
00205
00206 #define BUFSIZ 1024
00207 #define EOF (-1)
00208
00209
00210
00211
00212
00213
00214
00215 #define FOPEN_MAX 20
00216 #ifndef __SYMBIAN32__
00217 #define FILENAME_MAX 1024
00218 #else
00219 #define FILENAME_MAX 256
00220 #endif
00221
00222
00223 #if (defined(__SYMBIAN32__) && (defined(__WINSCW__) || defined(__WINS__)))
00224 #define GET_WSD_VAR_NAME(var,varprefix) _##varprefix##_##var
00225 char **GET_WSD_VAR_NAME(tmpdirptr, g)();
00226 #define __tmpdirptr (*GET_WSD_VAR_NAME(tmpdirptr, g)())
00227 #else
00228 extern char* __tmpdirptr;
00229 #endif
00230
00231 #if __XSI_VISIBLE
00232 #ifndef __SYMBIAN32__
00233 #define P_tmpdir "/var/tmp/"
00234 #else
00235 #define P_tmpdir (tmpdirname())
00236 #define WIDEP_tmpdir (tmpdirname())
00237
00238 #endif
00239 #endif
00240 #ifndef __SYMBIAN32__
00241 #define L_tmpnam 1024
00242 #else
00243 #define L_tmpnam 256
00244 #endif
00245 #define TMP_MAX 308915776
00246
00247 #ifndef SEEK_SET
00248 #define SEEK_SET 0
00249 #endif
00250 #ifndef SEEK_CUR
00251 #define SEEK_CUR 1
00252 #endif
00253 #ifndef SEEK_END
00254 #define SEEK_END 2
00255 #endif
00256
00257 #if (defined(__SYMBIAN32__) && (defined(__WINSCW__) || defined(__WINS__)))
00258
00259 #define GET_WSD_VAR_NAME(var,varprefix) _##varprefix##_##var
00260
00261 FILE **GET_WSD_VAR_NAME(__stdinp, g)();
00262 FILE **GET_WSD_VAR_NAME(__stdoutp, g)();
00263 FILE **GET_WSD_VAR_NAME(__stderrp, g)();
00264
00265 #define __stdinp (*GET_WSD_VAR_NAME(__stdinp, g)())
00266 #define __stdoutp (*GET_WSD_VAR_NAME(__stdoutp, g)())
00267 #define __stderrp (*GET_WSD_VAR_NAME(__stderrp, g)())
00268
00269 #endif
00270
00271 #ifndef __SYMBIAN32__
00272 #define stdin __stdinp
00273 #define stdout __stdoutp
00274 #define stderr __stderrp
00275 #else
00276 __BEGIN_DECLS
00277 IMPORT_C FILE *__stdin (void);
00278 IMPORT_C FILE *__stdout (void);
00279 IMPORT_C FILE *__stderr (void);
00280 IMPORT_C char * tmpdirname(void);
00281 __END_DECLS
00282 #define stdin (__stdin())
00283 #define stdout (__stdout())
00284 #define stderr (__stderr())
00285 #endif
00286
00287 __BEGIN_DECLS
00288
00289
00290
00291 IMPORT_C void clearerr(FILE *);
00292 IMPORT_C int fclose(FILE *);
00293 IMPORT_C int feof(FILE *);
00294 IMPORT_C int ferror(FILE *);
00295 IMPORT_C int fflush(FILE *);
00296 IMPORT_C int fgetc(FILE *);
00297 IMPORT_C int fgetpos(FILE * __restrict, fpos_t * __restrict);
00298 IMPORT_C char *fgets(char * __restrict, int, FILE * __restrict);
00299 IMPORT_C FILE *fopen(const char * __restrict, const char * __restrict);
00300 IMPORT_C int fprintf(FILE * __restrict, const char * __restrict, ...);
00301 IMPORT_C int fputc(int, FILE *);
00302 IMPORT_C int fputs(const char * __restrict, FILE * __restrict);
00303 IMPORT_C size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
00304 IMPORT_C FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict);
00305 IMPORT_C int fscanf(FILE * __restrict, const char * __restrict, ...);
00306 IMPORT_C int fseek(FILE *, long, int);
00307 IMPORT_C int fsetpos(FILE *, const fpos_t *);
00308 IMPORT_C long ftell(FILE *);
00309 IMPORT_C size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
00310 IMPORT_C int getc(FILE *);
00311 IMPORT_C int getchar(void);
00312 IMPORT_C char *gets(char *);
00313 IMPORT_C void perror(const char *);
00314 IMPORT_C int printf(const char * __restrict, ...);
00315 IMPORT_C int putc(int, FILE *);
00316 IMPORT_C int putchar(int);
00317 IMPORT_C int puts(const char *);
00318 IMPORT_C int remove(const char *);
00319 IMPORT_C int rename(const char *, const char *);
00320 IMPORT_C void rewind(FILE *);
00321 IMPORT_C int scanf(const char * __restrict, ...);
00322 IMPORT_C void setbuf(FILE * __restrict, char * __restrict);
00323 IMPORT_C int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
00324 IMPORT_C int sprintf(char * __restrict, const char * __restrict, ...);
00325 IMPORT_C int sscanf(const char * __restrict, const char * __restrict, ...);
00326 IMPORT_C FILE *tmpfile(void);
00327 IMPORT_C char *tmpnam(char *);
00328 IMPORT_C int ungetc(int, FILE *);
00329 IMPORT_C int vfprintf(FILE * __restrict, const char * __restrict,
00330 va_list);
00331 IMPORT_C int vprintf(const char * __restrict, va_list);
00332 IMPORT_C int vsprintf(char * __restrict, const char * __restrict,
00333 va_list);
00334
00335 #if __ISO_C_VISIBLE >= 1999
00336 IMPORT_C int snprintf(char * __restrict, size_t, const char * __restrict,
00337 ...) __printflike(3, 4);
00338 IMPORT_C int vfscanf(FILE * __restrict, const char * __restrict, va_list)
00339 __scanflike(2, 0);
00340 IMPORT_C int vscanf(const char * __restrict, va_list) __scanflike(1, 0);
00341 IMPORT_C int vsnprintf(char * __restrict, size_t, const char * __restrict,
00342 va_list) __printflike(3, 0);
00343 IMPORT_C int vsscanf(const char * __restrict, const char * __restrict, va_list)
00344 __scanflike(2, 0);
00345 #endif
00346
00347
00348
00349
00350 #if __BSD_VISIBLE || __POSIX_VISIBLE <= 199506
00351
00352 #define L_cuserid 17
00353 #endif
00354
00355 #if __POSIX_VISIBLE
00356 #ifndef __SYMBIAN32__
00357 #define L_ctermid 1024
00358 #else
00359 #define L_ctermid 256
00360 #endif
00361 IMPORT_C FILE *fdopen(int, const char *);
00362 IMPORT_C int fileno(FILE *);
00363 #endif
00364
00365 #if __POSIX_VISIBLE >= 199209
00366 int pclose(FILE *);
00367 IMPORT_C FILE *popen(const char *, const char *);
00368 #endif
00369
00370 #ifdef __SYMBIAN32__
00371 IMPORT_C int popen3(const char *file, const char *cmd, char** envp, int fds[3]);
00372 #endif
00373
00374 #if __POSIX_VISIBLE >= 199506
00375 IMPORT_C int ftrylockfile(FILE *);
00376 IMPORT_C void flockfile(FILE *);
00377 IMPORT_C void funlockfile(FILE *);
00378
00379
00380
00381
00382
00383 IMPORT_C int getc_unlocked(FILE *);
00384 IMPORT_C int getchar_unlocked(void);
00385 IMPORT_C int putc_unlocked(int, FILE *);
00386 IMPORT_C int putchar_unlocked(int);
00387 #endif
00388
00389 #if __POSIX_VISIBLE >= 200112
00390 int fseeko(FILE *, __off_t, int);
00391 __off_t ftello(FILE *);
00392 #endif
00393
00394 #if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600
00395 IMPORT_C int getw(FILE *);
00396 IMPORT_C int putw(int, FILE *);
00397 #endif
00398
00399 #if __XSI_VISIBLE
00400 IMPORT_C char *tempnam(const char *, const char *);
00401 #endif
00402
00403
00404
00405
00406 #if __BSD_VISIBLE
00407 IMPORT_C int asprintf(char **, const char *, ...) __printflike(2, 3);
00408 #if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3
00409 #define __ATTR_FORMAT_ARG __attribute__((__format_arg__(2)))
00410 #else
00411 #define __ATTR_FORMAT_ARG
00412 #endif
00413 IMPORT_C void setbuffer(FILE *, char *, int);
00414 IMPORT_C int setlinebuf(FILE *);
00415 IMPORT_C int vasprintf(char **, const char *, va_list)
00416 __printflike(2, 0);
00417
00418 #ifndef __SYMBIAN32__
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431 extern __const int sys_nerr;
00432 extern __const char *__const sys_errlist[];
00433 #endif
00434
00435
00436
00437
00438 #ifndef _FTRUNCATE_DECLARED
00439 #define _FTRUNCATE_DECLARED
00440 IMPORT_C int ftruncate(int, __off_t);
00441 #endif
00442 #ifndef _LSEEK_DECLARED
00443 #define _LSEEK_DECLARED
00444 IMPORT_C __off_t lseek(int, __off_t, int);
00445 #endif
00446 #ifndef _MMAP_DECLARED
00447 #define _MMAP_DECLARED
00448 IMPORT_C void *mmap(void *, size_t, int, int, int, __off_t);
00449 #endif
00450 #ifndef _TRUNCATE_DECLARED
00451 #define _TRUNCATE_DECLARED
00452 IMPORT_C int truncate(const char *, __off_t);
00453 #endif
00454 #endif
00455
00456
00457
00458
00459 #ifdef __SYMBIAN32__
00460 IMPORT_C int __srget(FILE *);
00461 IMPORT_C int __swbuf(int, FILE *);
00462 #else
00463 int __srget(FILE *);
00464 int __swbuf(int, FILE *);
00465 #endif
00466
00467
00468
00469
00470
00471 #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
00472 #if defined(__GNUC__) && defined(__STDC__)
00473 static __inline int __sputc(int _c, FILE *_p) {
00474 if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
00475 return (*_p->_p++ = _c);
00476 else
00477 return (__swbuf(_c, _p));
00478 }
00479 #else
00480
00481
00482
00483 #define __sputc(c, p) \
00484 (--(p)->_w < 0 ? \
00485 (p)->_w >= (p)->_lbfsize ? \
00486 (*(p)->_p = (c)), *(p)->_p != '\n' ? \
00487 (int)*(p)->_p++ : \
00488 __swbuf('\n', p) : \
00489 __swbuf((int)(c), p) : \
00490 (*(p)->_p = (c), (int)*(p)->_p++))
00491 #endif
00492
00493 #define __sfeof(p) (((p)->_flags & __SEOF) != 0)
00494 #define __sferror(p) (((p)->_flags & __SERR) != 0)
00495 #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
00496 #define __sfileno(p) ((p)->_file)
00497
00498 #ifndef __SYMBIAN32__
00499 extern int __isthreaded;
00500
00501 #define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p))
00502 #define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p))
00503 #define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p))
00504
00505 #if __POSIX_VISIBLE
00506 #define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p))
00507 #endif
00508
00509 #define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp))
00510 #define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp))
00511
00512 #define getchar() getc(stdin)
00513 #define putchar(x) putc(x, stdout)
00514
00515 #else
00516 IMPORT_C int* isthreaded(void);
00517 #define __isthreaded (*isthreaded())
00518
00519 #define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p))
00520 #define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p))
00521 #define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p))
00522
00523 #if __POSIX_VISIBLE
00524 #define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p))
00525 #endif
00526
00527 #define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp))
00528 #define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp))
00529
00530 #define getchar() getc(stdin)
00531 #define putchar(x) putc(x, stdout)
00532
00533 #endif
00534
00535
00536 #if __POSIX_VISIBLE >= 199506
00537 #ifndef __SYMBIAN32__
00538 #define getc_unlocked(fp) __sgetc(fp)
00539 #define putc_unlocked(x, fp) __sputc(x, fp)
00540
00541 #define getchar_unlocked() getc_unlocked(stdin)
00542 #define putchar_unlocked(x) putc_unlocked(x, stdout)
00543 #endif
00544 #endif
00545
00546
00547 #ifdef __cplusplus
00548 }
00549 #endif
00550
00551
00552 __END_DECLS
00553 #endif