stdio.h

Go to the documentation of this file.
00001 /*-
00002  * Copyright (c) 1990, 1993
00003  *      The Regents of the University of California.  All rights reserved.
00004  *
00005  * This code is derived from software contributed to Berkeley by
00006  * Chris Torek.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  * 1. Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  * 2. Redistributions in binary form must reproduce the above copyright
00014  *    notice, this list of conditions and the following disclaimer in the
00015  *    documentation and/or other materials provided with the distribution.
00016  * 3. All advertising materials mentioning features or use of this software
00017  *    must display the following acknowledgement:
00018  *      This product includes software developed by the University of
00019  *      California, Berkeley and its contributors.
00020  * 4. Neither the name of the University nor the names of its contributors
00021  *    may be used to endorse or promote products derived from this software
00022  *    without specific prior written permission.
00023  *
00024  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
00025  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00026  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00027  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
00028  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00029  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00030  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00031  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00033  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00034  * SUCH DAMAGE.
00035  *
00036  *      @(#)stdio.h     8.5 (Berkeley) 4/29/95
00037  * $FreeBSD: src/include/stdio.h,v 1.56 2004/06/20 10:01:30 tjr Exp $
00038  *  © Portions copyright (c) 2005-2006  Nokia Corporation.  All rights reserved.
00039  * © Portions copyright (c) 2007 Symbian Software Ltd. All rights reserved.
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 //__SYMBIAN32__
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 //_VA_COPY_DEFINED
00086 #endif
00087 // __SYMBIAN32__
00088 #endif
00089 #define _FSTDIO                 /* Define for new stdio with functions. */
00090 
00091 /*
00092  * NB: to fit things in six character monocase externals, the stdio
00093  * code uses the prefix `__s' for stdio objects, typically followed
00094  * by a three-character attempt at a mnemonic.
00095  */
00096 
00097 /* stdio buffers */
00098 struct __sbuf {
00099         unsigned char *_base;
00100         int     _size;
00101 };
00102 
00103 /* hold a buncha junk that would grow the ABI */
00104 struct __sFILEX;
00105 
00106 /*
00107  * stdio state variables.
00108  *
00109  * The following always hold:
00110  *
00111  *      if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
00112  *              _lbfsize is -_bf._size, else _lbfsize is 0
00113  *      if _flags&__SRD, _w is 0
00114  *      if _flags&__SWR, _r is 0
00115  *
00116  * This ensures that the getc and putc macros (or inline functions) never
00117  * try to write or read from a file that is in `read' or `write' mode.
00118  * (Moreover, they can, and do, automatically switch from read mode to
00119  * write mode, and back, on "r+" and "w+" files.)
00120  *
00121  * _lbfsize is used only to make the inline line-buffered output stream
00122  * code as compact as possible.
00123  *
00124  * _ub, _up, and _ur are used when ungetc() pushes back more characters
00125  * than fit in the current _bf, or when ungetc() pushes back a character
00126  * that does not match the previous one in _bf.  When this happens,
00127  * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
00128  * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
00129  */
00130 typedef struct __sFILE {
00131         unsigned char *_p;      /* current position in (some) buffer */
00132         int     _r;             /* read space left for getc() */
00133         int     _w;             /* write space left for putc() */
00134         short   _flags;         /* flags, below; this FILE is free if 0 */
00135         short   _file;          /* fileno, if Unix descriptor, else -1 */
00136         struct  __sbuf _bf;     /* the buffer (at least 1 byte, if !NULL) */
00137         int     _lbfsize;       /* 0 or -_bf._size, for inline putc */
00138 
00139         /* operations */
00140         void    *_cookie;       /* cookie passed to io functions */
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         /* separate buffer for long sequences of ungetc() */
00147         struct  __sbuf _ub;     /* ungetc buffer */
00148         struct __sFILEX *_extra; /* additions to FILE to not break ABI */
00149         int     _ur;            /* saved _r when _r is counting ungetc data */
00150 
00151         /* tricks to meet minimum requirements even when malloc() fails */
00152         unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
00153         unsigned char _nbuf[1]; /* guarantee a getc() buffer */
00154 
00155         /* separate buffer for fgetln() when line crosses buffer boundary */
00156         struct  __sbuf _lb;     /* buffer for fgetln() */
00157 
00158         /* Unix stdio files get aligned to block boundaries on fseek() */
00159         int     _blksize;       /* stat.st_blksize (may be != _bf._size) */
00160         fpos_t  _offset;        /* current lseek 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 //EMULATOR
00170 #endif
00171 __END_DECLS
00172 #define _STDSTREAM_DECLARED
00173 #endif
00174 
00175 #define __SLBF  0x0001          /* line buffered */
00176 #define __SNBF  0x0002          /* unbuffered */
00177 #define __SRD   0x0004          /* OK to read */
00178 #define __SWR   0x0008          /* OK to write */
00179         /* RD and WR are never simultaneously asserted */
00180 #define __SRW   0x0010          /* open for reading & writing */
00181 #define __SEOF  0x0020          /* found EOF */
00182 #define __SERR  0x0040          /* found error */
00183 #define __SMBF  0x0080          /* _buf is from malloc */
00184 #define __SAPP  0x0100          /* fdopen()ed in append mode */
00185 #define __SSTR  0x0200          /* this is an sprintf/snprintf string */
00186 #define __SOPT  0x0400          /* do fseek() optimization */
00187 #define __SNPT  0x0800          /* do not do fseek() optimization */
00188 #define __SOFF  0x1000          /* set iff _offset is in fact correct */
00189 #define __SMOD  0x2000          /* true => fgetln modified _p text */
00190 #define __SALC  0x4000          /* allocate string space dynamically */
00191 #define __SIGN  0x8000          /* ignore this file in _fwalk */
00192 
00193 /*
00194  * The following three definitions are for ANSI C, which took them
00195  * from System V, which brilliantly took internal interface macros and
00196  * made them official arguments to setvbuf(), without renaming them.
00197  * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
00198  *
00199  * Although numbered as their counterparts above, the implementation
00200  * does not rely on this.
00201  */
00202 #define _IOFBF  0               /* setvbuf should set fully buffered */
00203 #define _IOLBF  1               /* setvbuf should set line buffered */
00204 #define _IONBF  2               /* setvbuf should set unbuffered */
00205 
00206 #define BUFSIZ  1024            /* size of buffer used by setbuf */
00207 #define EOF     (-1)
00208 
00209 /*
00210  * FOPEN_MAX is a minimum maximum, and is the number of streams that
00211  * stdio can provide without attempting to allocate further resources
00212  * (which could fail).  Do not use this for anything.
00213  */
00214                                 /* must be == _POSIX_STREAM_MAX <limits.h> */
00215 #define FOPEN_MAX       20      /* must be <= OPEN_MAX <sys/syslimits.h> */
00216 #ifndef __SYMBIAN32__
00217 #define FILENAME_MAX    1024    /* must be <= PATH_MAX <sys/syslimits.h> */
00218 #else
00219 #define FILENAME_MAX    256     /* must be <= PATH_MAX <sys/syslimits.h> */
00220 #endif /* __SYMBIAN32__ */
00221 
00222 /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
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 //__SYMBIAN32__
00238 #endif
00239 #endif
00240 #ifndef __SYMBIAN32__
00241 #define L_tmpnam        1024    /* XXX must be == PATH_MAX */
00242 #else
00243 #define L_tmpnam        256     /* XXX must be == PATH_MAX */
00244 #endif /* __SYMBIAN32__ */
00245 #define TMP_MAX         308915776
00246 
00247 #ifndef SEEK_SET
00248 #define SEEK_SET        0       /* set file offset to offset */
00249 #endif
00250 #ifndef SEEK_CUR
00251 #define SEEK_CUR        1       /* set file offset to current plus offset */
00252 #endif
00253 #ifndef SEEK_END
00254 #define SEEK_END        2       /* set file offset to EOF plus offset */
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 //EMULATOR
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  * Functions defined in ANSI C standard.
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  * Functions defined in all versions of POSIX 1003.1.
00349  */
00350 #if __BSD_VISIBLE || __POSIX_VISIBLE <= 199506
00351 /* size for cuserid(3); UT_NAMESIZE + 1, see <utmp.h> */
00352 #define L_cuserid       17      /* legacy */
00353 #endif
00354 
00355 #if __POSIX_VISIBLE
00356 #ifndef __SYMBIAN32__
00357 #define L_ctermid       1024    /* size for ctermid(3); PATH_MAX */
00358 #else
00359 #define L_ctermid       256        /* size for ctermid(3); PATH_MAX */
00360 #endif /* __SYMBIAN32__ */
00361 IMPORT_C FILE   *fdopen(int, const char *);
00362 IMPORT_C int     fileno(FILE *);
00363 #endif /* __POSIX_VISIBLE */
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  * These are normally used through macros as defined below, but POSIX
00381  * requires functions as well.
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 /* BSD or X/Open before issue 6 */
00398 
00399 #if __XSI_VISIBLE
00400 IMPORT_C char   *tempnam(const char *, const char *);
00401 #endif
00402 
00403 /*
00404  * Routines that are purely local.
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  * The system error table contains messages for the first sys_nerr
00421  * positive errno values.  Use strerror() or strerror_r() from <string.h>
00422  * instead.
00423  */
00424 
00425 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
00426  * are available on this system.  Even if available, these variables
00427  * should not be used directly.  The `strerror' function provides
00428  * all the necessary functionality.
00429  */
00430  
00431 extern __const int sys_nerr;
00432 extern __const char *__const sys_errlist[];
00433 #endif /* __SYMBIAN32__ */
00434 
00435 /*
00436  * Portability hacks.  See <sys/types.h>.
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 /* __BSD_VISIBLE */
00455 
00456 /*
00457  * Functions internal to the implementation.
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 /*__SYMBIAN32__ */
00466 
00467 /*
00468  * The __sfoo macros are here so that we can
00469  * define function versions in the C library.
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  * This has been tuned to generate reasonable code on the vax using pcc.
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 //__SYMBIAN32__
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 /* !_STDIO_H_ */

Copyright © Nokia Corporation 2001-2008
Back to top