sl@0: /*- sl@0: sl@0: * Copyright (c) 1990, 1993 sl@0: * The Regents of the University of California. All rights reserved. sl@0: * sl@0: * This code is derived from software contributed to Berkeley by sl@0: * Chris Torek. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * 4. Neither the name of the University nor the names of its contributors sl@0: * may be used to endorse or promote products derived from this software sl@0: * without specific prior written permission. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND sl@0: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE sl@0: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE sl@0: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL sl@0: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS sl@0: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT sl@0: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY sl@0: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF sl@0: * SUCH DAMAGE. sl@0: * sl@0: * @(#)stdio.h 8.5 (Berkeley) 4/29/95 sl@0: * $FreeBSD: src/include/stdio.h,v 1.56 2004/06/20 10:01:30 tjr Exp $ sl@0: * Portions Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. sl@0: */ sl@0: sl@0: #ifndef _STDIO_H_ sl@0: #define _STDIO_H_ sl@0: sl@0: #ifdef __cplusplus sl@0: extern "C" { sl@0: #endif sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: #include <_ansi.h> sl@0: #include sl@0: #include sl@0: #endif sl@0: sl@0: sl@0: sl@0: typedef __off_t fpos_t; sl@0: sl@0: #if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS) sl@0: typedef __off_t fpos64_t; sl@0: #endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */ sl@0: sl@0: #ifndef _SIZE_T_DECLARED sl@0: typedef __size_t size_t; sl@0: #define _SIZE_T_DECLARED sl@0: #endif sl@0: sl@0: #ifndef __SYMBIAN32__ sl@0: //#ifndef __DOXYGEN__ sl@0: #if (__BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE) && !__SYMBIAN32__ sl@0: #ifndef _VA_LIST_DECLARED sl@0: typedef __va_list va_list; sl@0: #define va_list __e32_va_list sl@0: #define _VA_LIST_DECLARED sl@0: #endif sl@0: #endif sl@0: //#endif //__DOXYGEN__ sl@0: #else //__SYMBIAN32__ sl@0: #include sl@0: #include sl@0: #endif //__SYMBIAN32__ sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: #ifndef __DOXYGEN__ sl@0: #define vfscanf __vfscanf sl@0: #endif //__DOXYGEN__ sl@0: #ifndef _VA_COPY_DEFINED sl@0: #define va_copy(dst,src) (dst = src) sl@0: #define _VA_COPY_DEFINED sl@0: #endif //_VA_COPY_DEFINED sl@0: #endif // __SYMBIAN32__ sl@0: #define _FSTDIO /* Define for new stdio with functions. */ sl@0: sl@0: /* sl@0: * NB: to fit things in six character monocase externals, the stdio sl@0: * code uses the prefix `__s' for stdio objects, typically followed sl@0: * by a three-character attempt at a mnemonic. sl@0: */ sl@0: sl@0: /* stdio buffers */ sl@0: struct __sbuf { sl@0: unsigned char *_base; sl@0: int _size; sl@0: }; sl@0: sl@0: /* hold a buncha junk that would grow the ABI */ sl@0: struct __sFILEX; sl@0: sl@0: /* sl@0: * stdio state variables. sl@0: * sl@0: * The following always hold: sl@0: * sl@0: * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), sl@0: * _lbfsize is -_bf._size, else _lbfsize is 0 sl@0: * if _flags&__SRD, _w is 0 sl@0: * if _flags&__SWR, _r is 0 sl@0: * sl@0: * This ensures that the getc and putc macros (or inline functions) never sl@0: * try to write or read from a file that is in `read' or `write' mode. sl@0: * (Moreover, they can, and do, automatically switch from read mode to sl@0: * write mode, and back, on "r+" and "w+" files.) sl@0: * sl@0: * _lbfsize is used only to make the inline line-buffered output stream sl@0: * code as compact as possible. sl@0: * sl@0: * _ub, _up, and _ur are used when ungetc() pushes back more characters sl@0: * than fit in the current _bf, or when ungetc() pushes back a character sl@0: * that does not match the previous one in _bf. When this happens, sl@0: * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff sl@0: * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. sl@0: */ sl@0: typedef struct __sFILE { sl@0: unsigned char *_p; /* current position in (some) buffer */ sl@0: int _r; /* read space left for getc() */ sl@0: int _w; /* write space left for putc() */ sl@0: short _flags; /* flags, below; this FILE is free if 0 */ sl@0: short _file; /* fileno, if Unix descriptor, else -1 */ sl@0: struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */ sl@0: int _lbfsize; /* 0 or -_bf._size, for inline putc */ sl@0: sl@0: /* operations */ sl@0: void *_cookie; /* cookie passed to io functions */ sl@0: int (*_close)(void *); sl@0: int (*_read)(void *, char *, int); sl@0: fpos_t (*_seek)(void *, fpos_t, int); sl@0: int (*_write)(void *, const char *, int); sl@0: sl@0: /* separate buffer for long sequences of ungetc() */ sl@0: struct __sbuf _ub; /* ungetc buffer */ sl@0: struct __sFILEX *_extra; /* additions to FILE to not break ABI */ sl@0: int _ur; /* saved _r when _r is counting ungetc data */ sl@0: sl@0: /* tricks to meet minimum requirements even when malloc() fails */ sl@0: unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ sl@0: unsigned char _nbuf[1]; /* guarantee a getc() buffer */ sl@0: sl@0: /* separate buffer for fgetln() when line crosses buffer boundary */ sl@0: struct __sbuf _lb; /* buffer for fgetln() */ sl@0: sl@0: /* Unix stdio files get aligned to block boundaries on fseek() */ sl@0: int _blksize; /* stat.st_blksize (may be != _bf._size) */ sl@0: fpos_t _offset; /* current lseek offset */ sl@0: } FILE; sl@0: sl@0: #ifndef _STDSTREAM_DECLARED sl@0: __BEGIN_DECLS sl@0: #if (!defined(__SYMBIAN32__) && (!defined(__WINSCW__) || !defined(__WINS__))) sl@0: extern FILE *__stdinp; sl@0: extern FILE *__stdoutp; sl@0: extern FILE *__stderrp; sl@0: #endif //EMULATOR sl@0: __END_DECLS sl@0: #define _STDSTREAM_DECLARED sl@0: #endif sl@0: sl@0: #define __SLBF 0x0001 /* line buffered */ sl@0: #define __SNBF 0x0002 /* unbuffered */ sl@0: #define __SRD 0x0004 /* OK to read */ sl@0: #define __SWR 0x0008 /* OK to write */ sl@0: /* RD and WR are never simultaneously asserted */ sl@0: #define __SRW 0x0010 /* open for reading & writing */ sl@0: #define __SEOF 0x0020 /* found EOF */ sl@0: #define __SERR 0x0040 /* found error */ sl@0: #define __SMBF 0x0080 /* _buf is from malloc */ sl@0: #define __SAPP 0x0100 /* fdopen()ed in append mode */ sl@0: #define __SSTR 0x0200 /* this is an sprintf/snprintf string */ sl@0: #define __SOPT 0x0400 /* do fseek() optimization */ sl@0: #define __SNPT 0x0800 /* do not do fseek() optimization */ sl@0: #define __SOFF 0x1000 /* set iff _offset is in fact correct */ sl@0: #define __SMOD 0x2000 /* true => fgetln modified _p text */ sl@0: #define __SALC 0x4000 /* allocate string space dynamically */ sl@0: #define __SIGN 0x8000 /* ignore this file in _fwalk */ sl@0: sl@0: /* sl@0: * The following three definitions are for ANSI C, which took them sl@0: * from System V, which brilliantly took internal interface macros and sl@0: * made them official arguments to setvbuf(), without renaming them. sl@0: * Hence, these ugly _IOxxx names are *supposed* to appear in user code. sl@0: * sl@0: * Although numbered as their counterparts above, the implementation sl@0: * does not rely on this. sl@0: */ sl@0: #define _IOFBF 0 /* setvbuf should set fully buffered */ sl@0: #define _IOLBF 1 /* setvbuf should set line buffered */ sl@0: #define _IONBF 2 /* setvbuf should set unbuffered */ sl@0: sl@0: #define BUFSIZ 1024 /* size of buffer used by setbuf */ sl@0: #define EOF (-1) sl@0: sl@0: /* sl@0: * FOPEN_MAX is a minimum maximum, and is the number of streams that sl@0: * stdio can provide without attempting to allocate further resources sl@0: * (which could fail). Do not use this for anything. sl@0: */ sl@0: /* must be == _POSIX_STREAM_MAX */ sl@0: #define FOPEN_MAX 20 /* must be <= OPEN_MAX */ sl@0: #ifndef __SYMBIAN32__ sl@0: #define FILENAME_MAX 1024 /* must be <= PATH_MAX */ sl@0: #else sl@0: #define FILENAME_MAX 256 /* must be <= PATH_MAX */ sl@0: #endif /* __SYMBIAN32__ */ sl@0: sl@0: /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ sl@0: #if (defined(__SYMBIAN32__) && (defined(__WINSCW__) || defined(__WINS__))) sl@0: #define GET_WSD_VAR_NAME(var,varprefix) _##varprefix##_##var sl@0: char **GET_WSD_VAR_NAME(tmpdirptr, g)(); sl@0: #define __tmpdirptr (*GET_WSD_VAR_NAME(tmpdirptr, g)()) sl@0: #else sl@0: extern char* __tmpdirptr; sl@0: #endif sl@0: sl@0: #if __XSI_VISIBLE sl@0: #ifndef __SYMBIAN32__ sl@0: #define P_tmpdir "/var/tmp/" sl@0: #else sl@0: #define P_tmpdir (tmpdirname()) sl@0: #define WIDEP_tmpdir (tmpdirname()) sl@0: #endif //__SYMBIAN32__ sl@0: #endif sl@0: #ifndef __SYMBIAN32__ sl@0: #define L_tmpnam 1024 /* XXX must be == PATH_MAX */ sl@0: #else sl@0: #define L_tmpnam 256 /* XXX must be == PATH_MAX */ sl@0: #endif /* __SYMBIAN32__ */ sl@0: #define TMP_MAX 308915776 sl@0: sl@0: #ifndef SEEK_SET sl@0: #define SEEK_SET 0 /* set file offset to offset */ sl@0: #endif sl@0: #ifndef SEEK_CUR sl@0: #define SEEK_CUR 1 /* set file offset to current plus offset */ sl@0: #endif sl@0: #ifndef SEEK_END sl@0: #define SEEK_END 2 /* set file offset to EOF plus offset */ sl@0: #endif sl@0: sl@0: #if (defined(__SYMBIAN32__) && (defined(__WINSCW__) || defined(__WINS__))) sl@0: sl@0: #define GET_WSD_VAR_NAME(var,varprefix) _##varprefix##_##var sl@0: sl@0: FILE **GET_WSD_VAR_NAME(__stdinp, g)(); sl@0: FILE **GET_WSD_VAR_NAME(__stdoutp, g)(); sl@0: FILE **GET_WSD_VAR_NAME(__stderrp, g)(); sl@0: sl@0: #define __stdinp (*GET_WSD_VAR_NAME(__stdinp, g)()) sl@0: #define __stdoutp (*GET_WSD_VAR_NAME(__stdoutp, g)()) sl@0: #define __stderrp (*GET_WSD_VAR_NAME(__stderrp, g)()) sl@0: #endif //EMULATOR sl@0: sl@0: #ifndef __SYMBIAN32__ sl@0: #define stdin __stdinp sl@0: #define stdout __stdoutp sl@0: #define stderr __stderrp sl@0: #else sl@0: __BEGIN_DECLS sl@0: IMPORT_C FILE *__stdin (void); sl@0: IMPORT_C FILE *__stdout (void); sl@0: IMPORT_C FILE *__stderr (void); sl@0: IMPORT_C char * tmpdirname(void); sl@0: __END_DECLS sl@0: #define stdin (__stdin()) sl@0: #define stdout (__stdout()) sl@0: #define stderr (__stderr()) sl@0: #endif sl@0: sl@0: __BEGIN_DECLS sl@0: /* sl@0: * Functions defined in ANSI C standard. sl@0: */ sl@0: IMPORT_C void clearerr(FILE *); sl@0: IMPORT_C int fclose(FILE *); sl@0: IMPORT_C int feof(FILE *); sl@0: IMPORT_C int ferror(FILE *); sl@0: IMPORT_C int fflush(FILE *); sl@0: IMPORT_C int fgetc(FILE *); sl@0: IMPORT_C int fgetpos(FILE * __restrict, fpos_t * __restrict); sl@0: IMPORT_C char *fgets(char * __restrict, int, FILE * __restrict); sl@0: IMPORT_C FILE *fopen(const char * __restrict, const char * __restrict); sl@0: IMPORT_C int fprintf(FILE * __restrict, const char * __restrict, ...); sl@0: IMPORT_C int fputc(int, FILE *); sl@0: IMPORT_C int fputs(const char * __restrict, FILE * __restrict); sl@0: IMPORT_C size_t fread(void * __restrict, size_t, size_t, FILE * __restrict); sl@0: IMPORT_C FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict); sl@0: IMPORT_C int fscanf(FILE * __restrict, const char * __restrict, ...); sl@0: IMPORT_C int fseek(FILE *, long, int); sl@0: IMPORT_C int fsetpos(FILE *, const fpos_t *); sl@0: IMPORT_C long ftell(FILE *); sl@0: IMPORT_C size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict); sl@0: IMPORT_C int getc(FILE *); sl@0: IMPORT_C int getchar(void); sl@0: IMPORT_C char *gets(char *); sl@0: IMPORT_C void perror(const char *); sl@0: IMPORT_C int printf(const char * __restrict, ...); sl@0: IMPORT_C int putc(int, FILE *); sl@0: IMPORT_C int putchar(int); sl@0: IMPORT_C int puts(const char *); sl@0: IMPORT_C int remove(const char *); sl@0: IMPORT_C int rename(const char *, const char *); sl@0: IMPORT_C void rewind(FILE *); sl@0: IMPORT_C int scanf(const char * __restrict, ...); sl@0: IMPORT_C void setbuf(FILE * __restrict, char * __restrict); sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: IMPORT_C int set_fmode(char mode); sl@0: IMPORT_C char get_fmode(void); sl@0: #endif sl@0: sl@0: IMPORT_C int setvbuf(FILE * __restrict, char * __restrict, int, size_t); sl@0: IMPORT_C int sprintf(char * __restrict, const char * __restrict, ...); sl@0: IMPORT_C int sscanf(const char * __restrict, const char * __restrict, ...); sl@0: IMPORT_C FILE *tmpfile(void); sl@0: IMPORT_C char *tmpnam(char *); sl@0: IMPORT_C int ungetc(int, FILE *); sl@0: IMPORT_C int vfprintf(FILE * __restrict, const char * __restrict, sl@0: va_list); sl@0: IMPORT_C int vprintf(const char * __restrict, va_list); sl@0: IMPORT_C int vsprintf(char * __restrict, const char * __restrict, sl@0: va_list); sl@0: sl@0: sl@0: #if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS) sl@0: #define fgetpos64 fgetpos sl@0: #define fopen64 fopen sl@0: #define freopen64 freopen sl@0: #define fsetpos64 fsetpos sl@0: #define tmpfile64 tmpfile sl@0: #endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */ sl@0: sl@0: sl@0: #if __ISO_C_VISIBLE >= 1999 sl@0: IMPORT_C int snprintf(char * __restrict, size_t, const char * __restrict, sl@0: ...) __printflike(3, 4); sl@0: IMPORT_C int vfscanf(FILE * __restrict, const char * __restrict, va_list) sl@0: __scanflike(2, 0); sl@0: IMPORT_C int vscanf(const char * __restrict, va_list) __scanflike(1, 0); sl@0: IMPORT_C int vsnprintf(char * __restrict, size_t, const char * __restrict, sl@0: va_list) __printflike(3, 0); sl@0: IMPORT_C int vsscanf(const char * __restrict, const char * __restrict, va_list) sl@0: __scanflike(2, 0); sl@0: #endif sl@0: sl@0: /* sl@0: * Functions defined in all versions of POSIX 1003.1. sl@0: */ sl@0: #if __BSD_VISIBLE || __POSIX_VISIBLE <= 199506 sl@0: /* size for cuserid(3); UT_NAMESIZE + 1, see */ sl@0: #define L_cuserid 17 /* legacy */ sl@0: #endif sl@0: sl@0: #if __POSIX_VISIBLE sl@0: #ifndef __SYMBIAN32__ sl@0: #define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ sl@0: #else sl@0: #define L_ctermid 256 /* size for ctermid(3); PATH_MAX */ sl@0: #endif /* __SYMBIAN32__ */ sl@0: IMPORT_C FILE *fdopen(int, const char *); sl@0: IMPORT_C int fileno(FILE *); sl@0: IMPORT_C int __sfileno(FILE* p); sl@0: #endif /* __POSIX_VISIBLE */ sl@0: sl@0: #if __POSIX_VISIBLE >= 199209 sl@0: IMPORT_C int pclose(FILE *); sl@0: IMPORT_C FILE *popen(const char *, const char *); sl@0: #endif sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: IMPORT_C int popen3(const char *file, const char *cmd, char** envp, int fds[3]); sl@0: #endif sl@0: sl@0: #if __POSIX_VISIBLE >= 199506 sl@0: IMPORT_C int ftrylockfile(FILE *); sl@0: IMPORT_C void flockfile(FILE *); sl@0: IMPORT_C void funlockfile(FILE *); sl@0: sl@0: /* sl@0: * These are normally used through macros as defined below, but POSIX sl@0: * requires functions as well. sl@0: */ sl@0: IMPORT_C int getc_unlocked(FILE *); sl@0: IMPORT_C int getchar_unlocked(void); sl@0: IMPORT_C int putc_unlocked(int, FILE *); sl@0: IMPORT_C int putchar_unlocked(int); sl@0: #endif sl@0: sl@0: #if __POSIX_VISIBLE >= 200112 sl@0: IMPORT_C int fseeko(FILE *, __off_t, int); sl@0: IMPORT_C __off_t ftello(FILE *); sl@0: sl@0: #if defined(SYMBIAN_OE_LARGE_FILE_SUPPORT) && !defined(SYMBIAN_OE_NO_LFS) sl@0: #define fseeko64 fseeko sl@0: #define ftello64 ftello sl@0: #endif /* SYMBIAN_OE_LARGE_FILE_SUPPORT && !SYMBIAN_OE_NO_LFS */ sl@0: sl@0: #endif sl@0: sl@0: #if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 sl@0: IMPORT_C int getw(FILE *); sl@0: IMPORT_C int putw(int, FILE *); sl@0: #endif /* BSD or X/Open before issue 6 */ sl@0: sl@0: #if __XSI_VISIBLE sl@0: IMPORT_C char *tempnam(const char *, const char *); sl@0: #endif sl@0: sl@0: /* sl@0: * Routines that are purely local. sl@0: */ sl@0: #if __BSD_VISIBLE sl@0: IMPORT_C int asprintf(char **, const char *, ...) __printflike(2, 3); sl@0: #if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3 sl@0: #define __ATTR_FORMAT_ARG __attribute__((__format_arg__(2))) sl@0: #else sl@0: #define __ATTR_FORMAT_ARG sl@0: #endif sl@0: IMPORT_C void setbuffer(FILE *, char *, int); sl@0: IMPORT_C int setlinebuf(FILE *); sl@0: IMPORT_C int vasprintf(char **, const char *, va_list) sl@0: __printflike(2, 0); sl@0: sl@0: #ifndef __SYMBIAN32__ sl@0: /* sl@0: * The system error table contains messages for the first sys_nerr sl@0: * positive errno values. Use strerror() or strerror_r() from sl@0: * instead. sl@0: */ sl@0: sl@0: /* Provide the declarations for `sys_errlist' and `sys_nerr' if they sl@0: * are available on this system. Even if available, these variables sl@0: * should not be used directly. The `strerror' function provides sl@0: * all the necessary functionality. sl@0: */ sl@0: sl@0: extern __const int sys_nerr; sl@0: extern __const char *__const sys_errlist[]; sl@0: #endif /* __SYMBIAN32__ */ sl@0: sl@0: /* sl@0: * Portability hacks. See . sl@0: */ sl@0: #ifndef _FTRUNCATE_DECLARED sl@0: #define _FTRUNCATE_DECLARED sl@0: IMPORT_C int ftruncate(int, __off_t); sl@0: #endif sl@0: #ifndef _LSEEK_DECLARED sl@0: #define _LSEEK_DECLARED sl@0: IMPORT_C __off_t lseek(int, __off_t, int); sl@0: #endif sl@0: #ifndef _MMAP_DECLARED sl@0: #define _MMAP_DECLARED sl@0: IMPORT_C void *mmap(void *, size_t, int, int, int, __off_t); sl@0: #endif sl@0: #ifndef _TRUNCATE_DECLARED sl@0: #define _TRUNCATE_DECLARED sl@0: IMPORT_C int truncate(const char *, __off_t); sl@0: #endif sl@0: #endif /* __BSD_VISIBLE */ sl@0: sl@0: #ifdef __SYMBIAN32__ sl@0: IMPORT_C int setecho(int fd, uint8_t echoval); sl@0: #endif sl@0: sl@0: /* sl@0: * Functions internal to the implementation. sl@0: */ sl@0: #ifdef __SYMBIAN32__ sl@0: IMPORT_C int __srget(FILE *); sl@0: IMPORT_C int __swbuf(int, FILE *); sl@0: #else sl@0: int __srget(FILE *); sl@0: int __swbuf(int, FILE *); sl@0: #endif /*__SYMBIAN32__ */ sl@0: sl@0: /* sl@0: * The __sfoo macros are here so that we can sl@0: * define function versions in the C library. sl@0: */ sl@0: #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) sl@0: #if defined(__GNUC__) && defined(__STDC__) sl@0: static __inline int __sputc(int _c, FILE *_p) { sl@0: if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) sl@0: return (*_p->_p++ = _c); sl@0: else sl@0: return (__swbuf(_c, _p)); sl@0: } sl@0: #else sl@0: /* sl@0: * This has been tuned to generate reasonable code on the vax using pcc. sl@0: */ sl@0: #define __sputc(c, p) \ sl@0: (--(p)->_w < 0 ? \ sl@0: (p)->_w >= (p)->_lbfsize ? \ sl@0: (*(p)->_p = (c)), *(p)->_p != '\n' ? \ sl@0: (int)*(p)->_p++ : \ sl@0: __swbuf('\n', p) : \ sl@0: __swbuf((int)(c), p) : \ sl@0: (*(p)->_p = (c), (int)*(p)->_p++)) sl@0: #endif sl@0: sl@0: #define __sfeof(p) (((p)->_flags & __SEOF) != 0) sl@0: #define __sferror(p) (((p)->_flags & __SERR) != 0) sl@0: #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) sl@0: sl@0: #ifndef __SYMBIAN32__ sl@0: extern int __isthreaded; sl@0: sl@0: #define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p)) sl@0: #define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p)) sl@0: #define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p)) sl@0: sl@0: #if __POSIX_VISIBLE sl@0: #define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p)) sl@0: #endif sl@0: sl@0: #define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp)) sl@0: #define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp)) sl@0: sl@0: #define getchar() getc(stdin) sl@0: #define putchar(x) putc(x, stdout) sl@0: sl@0: #else sl@0: IMPORT_C int* isthreaded(void); sl@0: #define __isthreaded (*isthreaded()) sl@0: sl@0: #define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p)) sl@0: #define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p)) sl@0: #define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p)) sl@0: sl@0: #if __POSIX_VISIBLE sl@0: #define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p)) sl@0: #endif sl@0: sl@0: #define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp)) sl@0: #define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp)) sl@0: sl@0: #define getchar() getc(stdin) sl@0: #define putchar(x) putc(x, stdout) sl@0: #endif //__SYMBIAN32__ sl@0: sl@0: sl@0: #if __POSIX_VISIBLE >= 199506 sl@0: #ifndef __SYMBIAN32__ sl@0: #define getc_unlocked(fp) __sgetc(fp) sl@0: #define putc_unlocked(x, fp) __sputc(x, fp) sl@0: sl@0: #define getchar_unlocked() getc_unlocked(stdin) sl@0: #define putchar_unlocked(x) putc_unlocked(x, stdout) sl@0: #endif sl@0: #endif sl@0: sl@0: //--- sl@0: #ifdef __cplusplus sl@0: } sl@0: #endif sl@0: //--- sl@0: sl@0: __END_DECLS sl@0: #endif /* !_STDIO_H_ */